Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We were moving about 4TB of files to a Windows Server08R2 from a Mac Sever. A lot of the filenames wouldn't go because of incompatible characters. We ran a renaming tool to fix the problem and copied again.

My problem is now I have a lot of folders that have very similar names like "O'Neil" and "O_Neil". In fact as far as I can tell they all conform to this rule.

There are too many to do by hand. I'm thinking of writing a script but I have limited experience with scripting. I'd like to compare the modify date or the filesize and merge or move the folders to an archive and leave one set in place. I'm not sure about best practice in this situation.

  1. In theory what is the best practice, merge by date, archive the smaller versions?
  2. In practice how can I go about fixing this are there tools? Script ideas?

Any help is hugely appreciated.

share|improve this question

1 Answer 1

If you are planing to move files to another machine I would suggest you to use rsync to move the files faster, instead of find+archive+copy+unarchive. So here a basic bash script to do this job.

thefiles=/tmp/files.$$

LOCALDIR=/localdir

REMOTEDIR=/remotedir

REMOTEHOST=192.168.1.1 #remoteip

changetime=2 #find files x days ago, in this case 2 days ago

cd $LOCALDIR || { echo cd failed 1>&2; exit 1; }

trap 'rm -f $thefiles' 0

find . -type f -ctime $changetime -print > $thefiles

rsync -v --archive --files-from=$thefiles . $REMOTEHOST:$REMOTEDIR

Dont forget to make private/public ssh key so remote server do not ask you for password.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.