Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: get file name to create folder

by b10m (Vicar)
on Nov 08, 2005 at 10:51 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-19 06:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found