renaming external files
hello all.
i have inherited a mixed bag of sorts: several xp users updating an access mdb with the BE on a lamp stack shared via samba. i have a backup device which gets mounted at: /media/disk...
each client record (has) a folder by the companyname on the samba share, and all relative documents are placed there.
when the backup script runs, it just copies newer or missing files.
someone has been renaming folders, and not matching the folder name to the related companyname from the mdb.
so...the backup script captures and duplicates the data in the renamed folders.
some client records also have periods in the name (not required from a data pov), such as 'Company Ltd.' instead of 'Company Ltd'.
i can produce a list of company names as the folders should be found easily enough, but get a little stuck with the linux scripting.
i can easily remove and further prevent any unwanted punctuation in the company name on the client record, and create the correct folder name on the samba share with vba, but would also like to:
-for each 'client activity' folder on the backup device
-rename the folder by removing punctuation marks
or
-delete the folder if is a dupe
i tried: ls -al | grep '&' - it properly returns only those lines with an ampersand in the folder name, but returns all folders when i try that with a '.'.
what would be the easiest method to do the renaming? i thought if there was a way to change ownership of the mounted device, then the vba code (easy to write) would be simple.
any ideers?
cheers,
.q
OK - i just ran chown -R on the external device, changing ownership to (me) instead of root. didn't want to because it took too long, but can now use the MoveFolder method of the filesystemobject from my app to do the renaming instead of some sort of bash script (which i was dreading).
.q
Last edited by Qube; 03-28-2011 at 06:33 PM.
Reason: add solution
|