Quick linux help :x

Please confine these topics to things that would be of general interest to those who are interested in FAH which don't fall into any other category.

Moderator: Site Moderators

Quick linux help :x

Postby Igloo » Wed Jan 28, 2009 1:32 am

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 :)
Image
Igloo
 
Posts: 29
Joined: Tue Nov 18, 2008 12:15 am

Re: Quick linux help :x

Postby alpha754293 » Wed Jan 28, 2009 9:24 am

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 :)


try this:

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.)
alpha754293
 
Posts: 638
Joined: Sun Jan 18, 2009 1:13 am


Return to Scientific discussions (Non-FAH)

Who is online

Users browsing this forum: No registered users and 1 guest

cron