I'm trying to remove the : in a bunch of directories so windows can access them via shares.
find . -type d -exec rename 's/\:$/\-/' {} \;
Should work i think, But it isn't.
Should replace the : with -
But it just errors with
find: ./example - folder - 1:00 - 2:00: No such file or directory
Cheers guys
Quick linux help :x
Moderator: Site Moderators
-
- Posts: 383
- Joined: Sun Jan 18, 2009 1:13 am
Re: Quick linux help :x
try this:Igloo wrote:I'm trying to remove the : in a bunch of directories so windows can access them via shares.
find . -type d -exec rename 's/\:$/\-/' {} \;
Should work i think, But it isn't.
Should replace the : with -
But it just errors with
find: ./example - folder - 1:00 - 2:00: No such file or directory
Cheers guys
find . -name *:* -type d -print
don't know if it'll work for you. That should generate the list. If you want, you can dump the list into a text file or something, and then use that as the start of your script to remove ":". *shrug*
(how in the world did you end up in that pickle?)
*edit*
If I were you (and I'm definitely no Linux admin), but I'd find all directories dump them into a text file, cat said text file, grep :, and dump the result into another text file.
find . -type d -print > directory.txt
cat directory.txt | grep : > time.txt
*shrug* you could also give that a shot
and then I'd probably do something like a shell script file that's
mv ...1:00 ...100
or something along those lines. It's a round about way, but it'd probably work. (I can't think of how you'd end up with directories that are like that cuz all of my time-coded directories do not have the ":" to begin with.)