oops, my bad, its because i copied it from another computer, i just had to create new script and chmod it, job done
---------- Post updated 04-27-16 at 04:52 AM ---------- Previous update was 04-26-16 at 06:34 AM ----------
Code:
#!/bin/bash
cd /to_be_archived/
for DIR in * ;
do
MailAddress="robertw@molinare.co.uk"
if inotifywait -rq -e modify,create,delete -t 60 "$DIR"/ ; then
mail -s "Modified $DIR" $MailAddress <<< "$DIR failed has been modified within the last minute"
continue
fi
if ! tar -cf "$DIR".tar "$DIR" ; then
mail -s "tar failed $DIR" $MailAddress <<< "creating of tar $DIR failed due to error, removing $DIR.tar"
rm -f "$DIR".tar
continue
fi
if [ -f /archived_projects/"$DIR".tar ]; then
mail -s "duplicate exists $DIR" $MailAddress <<< "$DIR.tar already exists"
rm -f "$DIR".tar
continue
fi
if ! rsync -a "$DIR".tar /archived_projects/ ; then
mail -s "rsync failed $DIR" $MailAddress <<< "rsync of $DIR failed due to error, removing $DIR.tar"
rm -f "$DIR".tar
continue
fi
if ! rm -f "$DIR".tar ; then
mail -s "remove tar failed $DIR" $MailAddress <<< "removing of tar $DIR failed due to error"
continue
fi
cd "$DIR"
date >> /archive_details.txt
echo -n "Folder to be archived = " >> /archive_details.txt
pwd >> /archive_details.txt
echo -n "Number of files = " >> /archive_details.txt
find . -type f | wc -l >> /archive_details.txt
echo -n "Size in GB = " >> /archive_details.txt
du . -s -B 1G >> /archive_details.txt
echo " " >> /archive_details.txt
cd ..
if ! rm -rf "$DIR" ; then
mail -s "remove folder failed $DIR" $MailAddress <<< "removing of $DIR failed due to error"
continue
else
mail -s "success $DIR" $MailAddress <<< "successfully completed archiving $DIR"
fi
done
Last edited by robertkwild; 04-27-2016 at 07:37 AM..
Hi.
I'm trying to copy multiple folders from the remote machine to the local machine. I wrote a batch file to run an ftp window.
The problem I am having is that the only command to copy files is mget *, and this copies only files, not folders.
For example, ftp ts555
cd ts555/test
' test... (5 Replies)
I have written a shell script to perform backups using tar, rsync and optionally utilise lvm snapshots. The script is not finished but is in a working state and comments/descriptions are poor.
I would greatly appreciate any criticism and suggestions of the script to help improve my own learning... (0 Replies)
I have in directory /media/AUDIO/WAVE many .mp3 files with names like:
my filename_01of02.mp3
my filename_02of02.mp3
Your File_01of06.mp3
Your File_02of06.mp3
etc....
In the same directory, /media/AUDIO/WAVE, I have many folders with names like
9780743579490
9780743579491
etc..
Inside... (7 Replies)
I have 1000's of directories which is named as numbers. Each directory contains multiple files. Each of these directories have a file named "att". I need to rename all the att files by adding the directory name followed by "_" then att for each of the directories.
Directories
120
att... (2 Replies)
Hi all,
I have a tar file and inside that tar file is a folder with additional tar.gz files. What I want to do is look inside the first tar file and then find the second tar file I'm looking for, look inside that tar.gz file to find a certain directory. I'm encountering issues by trying to... (1 Reply)
I would like to confirm my file.tar is been tar-ed correctly before I remove them. But I have very limited disc space to untar it.
Can I just do the listing instead of actual extract it? Can I say confirm folder integrity if the listing is sucessful without problem?
tar tvf file1.tar
... (1 Reply)
Hi All,
I have to requirement to write a shell script to move file from one folder (A) to another five folder (B,C,D,E,F) and destination folder should be blank. In not blank just skip.
This script will run as a scheduler every 2 minutes. It will check number of files in folder A and move 1 to... (9 Replies)
Good day, everyone!
I'm very new to bash scripting. Our teacher gave us a task to create a script that basically does the same job the 'du' command does, with the difference that 'du' command gives an output in the form of
<size> <folder name>and what we need is
<folder name> <size>As for... (1 Reply)
1. The problem statement, all variables and given/known data:
The task is to create a script that would reproduce the output of 'du' command, but in a different way: what 'du' does is:
<size> <folder name>and what is needed is
<folder name> <size>We need to show only 10 folders which are the... (3 Replies)
HI Guys,
I have some 8 files with different name and extensions. I need to check if they are present in a specific folder or not and also want that script to show me which all are not present. I can write if condition for each file but from a developer perspective , i feel that is not a good... (3 Replies)
Discussion started by: shankarpanda003
3 Replies
LEARN ABOUT MOJAVE
apple_dump
APPLE_DUMP(1) Netatalk 2.2 APPLE_DUMP(1)NAME
apple_dump - Dump AppleSingle/AppleDouble format file
SYNOPSIS
apple_dump [-a] FILE | DIR
apple_dump -f FILE
apple_dump -d FILE
apple_dump -h | -help | --help
apple_dump -v | -version | --version
DESCRIPTION
apple_dump dump AppleSingle/AppleDouble format file.
OPTIONS -a FILE|DIR
This is default. Dump a AppleSingle/AppleDouble file for FILE or DIR automatically. Extrapolate FinderInfo type from absolute path. If
FILE is not AppleSingle/AppleDouble format, look for .AppleDouble/FILE and ._FILE. If DIR, look for DIR/.AppleDouble/.Parent and ._DIR.
-f FILE
Dump FILE. Assume FinderInfo to be FileInfo.
-d FILE
Dump FILE. Assume FinderInfo to be DirInfo.
-h, -help, --help
Display the help and exit
-v, -version, --version
Show version and exit
NOTE
There is no way to detect whether FinderInfo is FileInfo or DirInfo. By default, apple_dump examins whether file or directory, a parent
directory is .AppleDouble, filename is ._*, filename is .Parent, and so on.
If setting option -f or -d, assume FinderInfo and doesn't look for another file.
SEE ALSO ad(1)Netatalk 2.2 02 Sep 2011 APPLE_DUMP(1)