code logs -> 2023 -> Sat, 19 Aug 2023< code.20230818.log - code.20230820.log >
--- Log opened Sat Aug 19 00:00:47 2023
02:41 Degi_ [Degi@Nightstar-qee.6ld.55.78.IP] has joined #code
02:43 Degi [Degi@Nightstar-9a9.30o.54.78.IP] has quit [Ping timeout: 121 seconds]
02:43 Degi_ is now known as Degi
03:05 PinkAFK [Pink@Nightstar-6ra7fb.sub-75-222-55.myvzw.com] has joined #code
03:08 Pinkhair [Pink@Nightstar-6ra7fb.sub-75-222-55.myvzw.com] has quit [Ping timeout: 121 seconds]
03:53 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has joined #code
03:53 mode/#code [+qo Vornicus Vornicus] by ChanServ
04:32 Pinkhair [Pink@Nightstar-6ra7fb.sub-75-222-55.myvzw.com] has joined #code
04:35 PinkAFK [Pink@Nightstar-6ra7fb.sub-75-222-55.myvzw.com] has quit [Ping timeout: 121 seconds]
04:56 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has quit [Connection closed]
06:54 panzerfaus [uid279771@Nightstar-l49s2t.irccloud.com] has quit [[NS] Quit: Connection closed for inactivity]
10:18 Emmy [Emmy@Nightstar-qo29c7.fixed.kpn.net] has joined #code
12:37 [R] [rms@Nightstar-q2o.lgn.70.184.IP] has quit [Ping timeout: 121 seconds]
15:01 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has joined #code
15:01 mode/#code [+qo Vornicus Vornicus] by ChanServ
16:27 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has quit [Connection closed]
19:25
< abudhabi>
What's a good *nix utility to track down every file that has a name that would be illegal on Windows?
20:14
< Emmy>
abudhabi, maybe this might provide some inspiration? https://www.makeuseof.com/batch-rename-files-in-linux/
20:43
<@gnolam>
Feels like the kind of thing where it'll take longer to find a tool that does what you want than hack together 10-15 lines of Python to do it the way you want it.
21:01 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has joined #code
21:01 mode/#code [+qo Vornicus Vornicus] by ChanServ
21:19
<&ToxicFrog>
abudhabi: find <dir> -regextype egrep \( -regex '[<>:"\\|?*]' -or -regex '.*/(CON|PRN|AUX|NUL|COM[0-9]|LPT[0-9])$' \)
21:20
<&ToxicFrog>
If you want to search the whole system, and you have `locate` installed, and you know the locatedb is sufficiently fresh, you can do it faster with with either a locate that supports regexes or by piping it through grep.
21:21
<&ToxicFrog>
In either case, if you want to do something with the files afterwards, you can slap a -print0 on the end (find) or -0 (locate) and then pipe it through xargs -0 to process everything.
21:21
<&ToxicFrog>
(or just use find's -exec option)
21:21
< abudhabi>
Just a subfolder, yeah, no need for /
21:21
<&ToxicFrog>
Oh, whoops, pasted the wrong iteration of the find command
21:21
<&ToxicFrog>
find . -regextype egrep \( -regex '.*/[^/]*[<>:"\\|?][^/]*$' -or -regex '.*/(CON|PRN|AUX|NUL|COM[0-9]|LPT[0-9])$' \)
21:21
<&ToxicFrog>
abudhabi: ^
21:22
<&ToxicFrog>
(-regex is less ergonomic than -name and it really wants a -leafregex or similar, oh well)
21:23
<&ToxicFrog>
But yeah, first regex matches all paths where the leaf name contains at least one of <>:"\|? (leaf only so that if you have a bad directory, it lists only the directory itself and not every file inside it), second regex matches paths where the name is exactly one of the forbidden names.
21:24
<&ToxicFrog>
find . -regextype egrep \( -regex '.*/[^/]*[<>:"\\|?*][^/]*$' -or -regex '.*/(CON|PRN|AUX|NUL|COM[0-9]|LPT[0-9])$' \)
21:24
<&ToxicFrog>
Forgot * from the first regex.
21:24
<&ToxicFrog>
(we can omit / because that's already forbidden on linux too)
21:25
< abudhabi>
Works.
21:28 * abudhabi begins dealing with the files.
21:28
< abudhabi>
Might as well make some "old crap I haven't touched in ages" archives.
21:28
< abudhabi>
Solves the filename issue instantly.
21:42
<@gnolam>
You also need to check for lowercase duplicates.
21:46
< abudhabi>
No complaints about that that I can see as yet.
21:58
< abudhabi>
Found some!
21:58
< abudhabi>
Thanks.
22:19
<&ToxicFrog>
Oh right, second one should have been -iregex
22:19
<&ToxicFrog>
Forgot that windows is case insensitive
22:57 Kizor [a@Nightstar-nfsqa7.yok.fi] has quit [[NS] Quit: ]
22:58 Kizor [a@Nightstar-nfsqa7.yok.fi] has joined #code
23:10 [R] [rms@Nightstar-d7h8ki.org] has joined #code
23:10 mode/#code [+ao [R] [R]] by ChanServ
23:59 Emmy [Emmy@Nightstar-qo29c7.fixed.kpn.net] has quit [Ping timeout: 121 seconds]
--- Log closed Sun Aug 20 00:00:49 2023
code logs -> 2023 -> Sat, 19 Aug 2023< code.20230818.log - code.20230820.log >

[ Latest log file ]