Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
rename all files with an extension
Name: roger Date: August 2, 2002 at 16:19:07 Pacific
Comment:
How do I rename all the files in a particular directory with the file extension .UNC for uncompressed. They are compressed and have a .Z extension but after I uncompress them they don't have an extension. This is on an AIX 4.2 ksh machine.
Name: Frank Date: August 4, 2002 at 23:42:10 Pacific
Reply:
Hi Roger,
I hope I understood the question correct.
for i in *.UNC ; do mv $i $i.Z done
this will change all *.unc files to *.unc.Z
I this what you would like to have or do you would like to replace the UNC against Z ?
No RISK no fun Frank
0
Response Number 2
Name: roger34 Date: August 6, 2002 at 14:13:53 Pacific
Reply:
Thanks Frank that worked great.
0
Response Number 3
Name: Dave Date: August 9, 2002 at 12:42:29 Pacific
Reply:
How would you go about replacing *.UNC with *.Z?
0
Response Number 4
Name: Frank Date: August 13, 2002 at 04:13:27 Pacific
Reply:
Hi Dave,
sorry didn't saw your question earlier.
for file in `ls *.i` ; do new=`echo $file | sed -e "s/.UNC$/.Z/" if [ ! -f ${new} ] then mv ${file} ${new} else echo "$new already exist " 1>&2 fi done
Summary: Thank you for your reply. Sorry, please disregard my original message. Actually, the date extensions do have the same formats, which is file.yyyymmdd. F or example: file1.20070823 file2.20060501 file3...
Summary: Dev: It depends on how 'source code' and 'execuatable' are defined. You can say my source code is all files with an extension of .c or .h and use the find command: find . -type f \( -name "*.c" -o -n...
Summary: I need to create a script that will remove a file if there is no extension. The file is generated with a random name, based on current date. The filename is passed in from a C program. I have tried t...