LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-28-2011, 01:08 PM   #1
Qube
LQ Newbie
 
Registered: Mar 2011
Location: Cobble Hill, BC Canada
Distribution: CentOS 5.5
Posts: 2

Rep: Reputation: 0
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
 
Old 03-31-2011, 01:57 AM   #2
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello and Welcome to LinuxQuestions,

Thanks for sharing the solution you found to your problem. Sure it'll come in handy for someone in the same situation. Off the Zero Reply List.

Kind regards,

Eric
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with renaming files EchoPhyber Linux - Newbie 4 03-26-2010 08:38 AM
Renaming files leupi Linux - General 5 09-16-2008 03:22 AM
renaming files starwarsfan982 Linux - Software 7 10-30-2006 02:06 PM
renaming files TomalakBORG Linux - Newbie 4 12-24-2005 10:14 AM
Renaming files TomalakBORG Linux - Newbie 2 12-05-2005 04:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration