Rename all the files within a folder with prefix “Unix_” i.e. suppose a folder has two files a.txt and b.pdf, then they both should be renamed from a single command to Unix_a.txt and Unix_b.pdf
相关问题
- Is shmid returned by shmget() unique across proces
- how to get running process information in java?
- Error building gcc 4.8.3 from source: libstdc++.so
- Why should we check WIFEXITED after wait in order
- Null-terminated string, opening file for reading
With rnm (you will need to install it):
Or
P.S : I am the author of this tool.
If your filenames contain no whitepace and you don't have any subdirectories, you can use a simple
for
loop:Otherwise use the convenient
rename
command (which is a perl script) - although it might not be available out of the box on every Unix (e.g. OS X doesn't come withrename
).A short overview at debian-administration.org:
If your filenames contain whitespace it's easier to use
find
, on Linux the following should work:On BSD systems, there is no
-printf
option, unfortunately. But GNU findutils should be installable (on e.g. Mac OS X withbrew install findutils
).