Hiii,

i have a doubt here--

DirCleanupList="logs tmp corefiles"
echo "$DirCleanupList" | perl -ne 'print join("\n", split(" ")) . "\n"; '
for dir in $DirCleanupList
do
BackupLocation="$BackupLocation/$dir"
mkdir -p $BackupLocation >/dev/null 2>&1
if [[ ! -d $BackupLocation ]]; then
echo "Unable to make backup directory: $BackupLocation"
continue
fi
done

I have to take backup of all the files inside directory dir(logs,tmp,corefiles) at the location $BackupLocation.i should take the backup of logs,tmp,corefiles inside the $BackupLocation directory and then remove the files and touch the files inside the directory dir(logs,tmp,corefiles).
else we can move the files from dir(logs,corefiles,tmp) to $BackupLocation then touch the file inside dir(logs,tmp,corefiles).

i appericicate your quick help.

Hey There,

Unless I'm misunderstanding, you just need to move the files and touch them once they're moved?

If so, in the loop:

mv $dir/* $BackupLocation/*
find $BackupLocation -exec touch {} \;

Hope that helps. If I'm way off base, please let me know :)

Thanks,

, Mike

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.