first of all: I'm new to unix and im not very experienced.
I've bought a rapsberry pi and i want it to be the backup-machine for my SD-Cards while im travelling (attached ssd, card reader, a small touch-tft)
I managed to modify it a litte bit (its sending information bubbles to the desktop).
What this script is doing:
1. It starts copying photos and videos as soon as i plug in a card reader (automatically)
My problem:
I want the script to do a check. To compare the old folder and the new folder and to check if everything has been transfered properly.
I don't even know where to start. I can't do it by myself.
I don't even know what the script should compare? Filesize? Number of files? Filesize seems a little risky, the sd-cards partition could be NTFS...AND the script should check the ,,FILE_MATCH=".*\" formats only.
It would seem that after the line:
you would want to run command something like:
presumably replacing the printf command with a call to logger. Instead of redirecting the cmp output to /dev/null you might want to save it in another file and also include the contents of that file with the data you send to logger.
This User Gave Thanks to Don Cragun For This Post:
Do I have to include the part \n' "$FILE" in the logger part?
Could you please check is this is right?
And how would you do the part with the log file?
Moderator's Comments:
Please use code tags as require red by forum rules!
You don't need to use a printf style format string operand with logger, but you do need a then in your if statement.
I think it would also be wise to keep track of whether or not any copies failed and include an indication of success or failure in the notify-send at the end of the background job part of your script.
This User Gave Thanks to Don Cragun For This Post:
Hi all new to the forums. Very beginner at shell scripting. What I'm trying to do is this:
Is the directory empty prior to removal of it? If not, inform the user that the directory is not empty and if the user wants to remove it remove or move the files in it first.
But I'm stuck.. It checks... (3 Replies)
I hope this thread is in the right forum...
This is for a .deb package that will be installed on Cydia.
Pre'note': I am installing a custom 'hosts' file and AdSheet.app directory. My problem is during a reinstall/upgrade. Cydia will run the entire installation process again, which means it... (1 Reply)
hi again,
having an issue with the code here because it doesnt work :D
can someone point what and how to change, please.
#!/bin/bash
#create directory mylabs, inside create 6 directories named by user.
DIR1="$1"
DIR2="$2"
if ; then
echo -n " there is a folder named mylabs,
what... (1 Reply)
Hello again,
A little while back I got help with creating a command to search all directories and sub directories for files from daystart of day x.
I'm wondering if there is a command that I've overlooked that may be able to search for / write folder names to an output file which ideally... (2 Replies)
Hi All,
I am new to Forums, as i am struggling for one script i am launched here.
I need to move more than 60,000+ folders in 1,00,000 folders to another server. I have the list of folders which should be moved. can anybody help me in sharing with the script for the above requirement.
... (4 Replies)
Hello. I'm here again.
I have a script in python and bash, and I need execute this script over all files in all folders.
Example:
Folder: CMDB
Subfolders: router1
router2
switch1
switch2
and in this folders exists a file called... (3 Replies)
I am a beginner to all of this but undertand the basic principles. I am currently working on a large task and struggling with a the final part.
I have two files,
folder 1 contains a list of around 20 files in binary (possibly treated as arrays?)
folder 2 contains several files and sub... (2 Replies)
im a bit new to this and have been playing quite a bit and cant figure it out :(
I have made a basic script:
cd /folder/software1/bin/;
echo "software1," >> /in/local/var/trace/davescripts/software.txt "\c";
ls -tm >> /in/local/var/trace/davescripts/software.txt;
and this basically... (1 Reply)
I have a folder called {homedata}
Within this folder there are 12 subfolders 200601.......200612
Within each subfolder there are 8 sets of files
Each filename commences with A B C D E F G or H,
so {filename}* can be used.
I am trying to write a script which will from the top level
go... (2 Replies)