Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: get file name to create folder

by b10m (Vicar)
on Nov 08, 2005 at 10:51 UTC ( #506691=note: print w/replies, xml ) Need Help??


in reply to get file name to create folder

... and UNIX (BASH in this case)

#!/bin/bash for FILE in *.txt do DIR=${FILE##*_} DIR=${DIR/.txt/} [ ! -d $DIR ] && mkdir $DIR mv $FILE $DIR done
--
b10m

All code is usually tested, but rarely trusted.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://506691]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2022-12-03 21:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?