0

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.

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by eggi
0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.