Simple File Rename Unix Script Needed

January 21, 2010 at 07:26:18
Specs: Windows XP
Hello,

On a daily basis, I have two .csv files in an FTP directory that I must manually rename. I need help creating a unix script to truncate the file name and remove the "mmddyy" portion. Details are as follows:

File directory on FTP server: servername\export\home\userID\data

The two files in that directory that must be renamed:
Data_Withdrawals_mmddyy.csv
Data_Trx_mmddyy.csv

As I am a unix novice, is there a simple script that can remove the _mmddyy portion from each of the .csv files, giving me the following result?
Data_Withdrawals_mmddyy.csv -> Data_Withdrawals.csv
and
Data_Trx_mmddyy.csv -> Data_Trx.csv

I'd appreciate any help I can get here, thanks.

edited by moderator: Moved from Windows XP Forum


See More: Simple File Rename Unix Script Needed

Report •

#1
January 21, 2010 at 07:31:56
Are you sure this is a linux box? "servername\export\home\userID\data" is a Windows directory convention because linux uses "/" not "\". Also, CSV files are Excel files. If his is an FTP server running on an IIS box then you can use batch scripting. But, if it is indeed an Apache box then you will need linux bash script.

Report •

#2
January 21, 2010 at 08:29:43
- The FTP server is running on a Sun Solaris box. I hope that helps.
- Understood on the .csv files being excel. The .csv files are simply the flat files that I'm having to deal with.

Report •

#3
January 21, 2010 at 08:45:59
Well then you are going to have to post this in a Unix/Linux forum not a Windows XP forum.

Report •
Related Solutions


Ask Question