Re: Change filenames recursively

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Matthew Anderson wrote:
I have hundreds of files that start with a * (asterisk) for the
filename.  I am needing to change the asterisk in every file to a _
(underscore).  Does

Anyone know what command I can use to recursively do that?  I appreciate
any help anyone can provide me.

Check out the 'find' command to locate the files. Then pipe that that thru a bit of Perl to create the commands.

$ ls test
*one  *three  *two

$ find test -name "\**"|perl -e 'foreach(<>){chomp$_;$aa=$_;$aa=~s/\*/_/;print"mv $_ $aa\n";}

mv test/*two test/_two
mv test/*one test/_one
mv test/*three test/_three

pipe to a shell for execution...


--
Stephen Carville <stephen@xxxxxxxxxxxxxx>
Unix and Network Admin
Nationwide Totalflood
6033 W. Century Blvd
Los Angeles, CA 90045
310-342-3602

--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux