Sponsored Content
Top Forums Shell Programming and Scripting Making a script to copy files not seen before (using md5sum) Post 302849055 by nbsparks on Friday 30th of August 2013 06:25:42 PM
Old 08-30-2013
OK. Revised the script code.
Code:
#!/bin/bash

# The source directory where the photo folder on the phone is mirrored to
SRC=/hd1/home/nick/test1

# The destination directory where we want to copy only new photos we have copied before
DST=/hd1/home/nick/test2

# The MD5 list file that tracks which files we have copied before
MD5=/hd1/home/nick/test1.md5

# Check files against the MD5 list and then copy if not previously copied
# Then add the md5 for that file to the MD5 list
for f in $SRC/*
do
  FMD5=md5sum $f
  grep -q $FMD5 $MD5
  if [[ $? -ne 0 ]]; then
    cp $SRC/$f $DST
    md5sum $f >> $MD5
  fi
done

Here is the actual location on the system:
Code:
nick@server /$ ls /hd1/home/nick/t* -l
-rw-r--r-- 1 nick nick    0 Aug 30 10:32 /hd1/home/nick/test1.md5

/hd1/home/nick/test1:
total 4
-rw-r--r-- 1 nick nick 51 Aug 30 10:28 testfile1.jpg

/hd1/home/nick/test2:
total 0

And the output:
Code:
nick@server ~$ ./copy2.sh
./copy2.sh: line 16: /hd1/home/nick/test1/testfile1.jpg: Permission denied

 

10 More Discussions You Might Find Interesting

1. Solaris

making copy of 0 level dump via ufsdump

Hi how do u make "copy" of o level dump taken via ufsdumo in solaris? To elaborate, imagine you have taken a 0 level dump via the following command ufsdump 0ulf /dev/rmt/1n / and then again execute the same command to take a second 0 level dump Now take an incremental dump ufsdump 1ulf... (2 Replies)
Discussion started by: vishalsngh
2 Replies

2. Shell Programming and Scripting

Running md5sum on a list of files

Hello, I would like to run md5sum on a list of files saved in a text file, and save the result in another file. (ie. md5sum `cat list.txt` > md5list.txt) I have tried several things, but I am always confronted to the same problem: some of the filenames have spaces. I have run sed on the... (5 Replies)
Discussion started by: SDelroen
5 Replies

3. UNIX for Dummies Questions & Answers

Making a copy of an Magneto Optical Disk

We are trying to make duplicates of some Magneto Optical Disks that were created in Irix 6.5. The disks are 2.3 gig and the using a scsi MOD drive. Is there possbily a disk copy like in dos or some simple script to do this - any help appreciated. Thanks (0 Replies)
Discussion started by: drew_holm
0 Replies

4. Shell Programming and Scripting

Making script show command (e.g. copy) being executed and variable substitution?

When script is running you only see when some of the commands are not successfull. Is there a way to see which command are executed and to show the substitution of variables as every line is executed ? (3 Replies)
Discussion started by: gr0124
3 Replies

5. Shell Programming and Scripting

Script to check MD5SUM on file

Hi, I currently have a shell script that takes an RPM and scp's it to a set of remote servers and installs it. What I would like to be able to do is make the script get the md5sum of the RPM locally (so get the md5sum of the rpm from where im running the script) and then scp the rpm to the... (0 Replies)
Discussion started by: tb1986
0 Replies

6. Shell Programming and Scripting

PHP Script Help - Making links to files Clickable

Ok so I wrote a php script that outputs the below to users on a webpage. # Download: /home/content/d/i/v/divine1234/eBookDownloads/ScalpRemedy_jablaa12734.zip the php code that outputs the above is: echo ("<li>Download: $download_link</li>\n"); The thing is, I dont want... (1 Reply)
Discussion started by: SkySmart
1 Replies

7. Shell Programming and Scripting

Md5sum script

Hello, I need to download multiple files from an FTP server but occasionally they arrive in error so I need to perform an integrity check. I've been attempting to write a bash script that does the following: Downloads all files including those in sub directories Perform md5sum using... (4 Replies)
Discussion started by: shadyuk
4 Replies

8. Shell Programming and Scripting

Compare files in directories with md5sum

And not to start. I can compare files, that's easy. The problem is that I compare files in a directory, and check if these files exist in another directory. The problem is that the file names are not the same. So I have to compare with "md5sum" or something similar. How I can do? All this in... (7 Replies)
Discussion started by: Jomeaide
7 Replies

9. Shell Programming and Scripting

Need script for making files based on some conditions.

Hi All, I have a text file (code_data.txt) with the followig data. AMAR AB123456 XYZ KIRAN CB789 ABC RAJ CS78890 XYZ KAMESH A33535335 ABC KUMAR MD678894 MAT RITESH SR3535355... (26 Replies)
Discussion started by: ROCK_PLSQL
26 Replies

10. Shell Programming and Scripting

[md5sum] script

I am getting No such file or directory if my variable contains white spaces... Is there a way to fix this? This works x="1.md5" md5sum -c "$x" This, does not x="23\ 5\ 6\ 7\ 8\ 9\ 10.md5" md5sum -c "$x" md5sum: '23\ 5\ 6\ 7\ 8\ 9\ 10.md5': No such file or directory How do I fix... (1 Reply)
Discussion started by: soichiro
1 Replies
Glib::ParamSpec(3pm)					User Contributed Perl Documentation				      Glib::ParamSpec(3pm)

NAME
Glib::ParamSpec - Wrapper to encapsulate metadate needed to specify parameters HIERARCHY
Glib::ParamSpec void DESTROY (GParamSpec * pspec) CODE: g_param_spec_unref (pspec); DESCRIPTION
Glib::ParamSpec encapsulates the metadata required to specify parameters. You will see these most often when creating new Glib::Object types; see "Glib::Type->register" and Glib::Object::Subclass. Parameter specifications allow you to provide limits for validation as well as nicknames and blurbs to document the parameters. Blurbs show up in reference documentation such as this page or the gtk+ C API reference; i'm not really sure where the nicknames get used. The Perl bindings for the most part ignore the difference between dashes and underscores in the paramspec names, which typically find use as the actual keys for object parameters. It's worth noting that Glib offers various sizes of integer and floating point values, while Perl really only deals with full integers and double precision floating point values. The size distinction is important for the underlying C libraries. METHODS
paramspec = Glib::ParamSpec->IV ($name, $nick, $blurb, $minimum, $maximum, $default_value, $flags) o $name (string) o $nick (string) o $blurb (string) o $minimum (integer) o $maximum (integer) o $default_value (integer) o $flags (Glib::ParamFlags) paramspec = Glib::ParamSpec->UV ($name, $nick, $blurb, $minimum, $maximum, $default_value, $flags) o $name (string) o $nick (string) o $blurb (string) o $minimum (unsigned) o $maximum (unsigned) o $default_value (unsigned) o $flags (Glib::ParamFlags) string = $pspec->get_blurb paramspec = Glib::ParamSpec->boolean ($name, $nick, $blurb, $default_value, $flags) o $name (string) o $nick (string) o $blurb (string) o $default_value (boolean) o $flags (Glib::ParamFlags) paramspec = Glib::ParamSpec->boxed ($name, $nick, $blurb, $package, $flags) o $name (string) o $nick (string) o $blurb (string) o $package (string) name of the class, derived from Glib::Boxed, of the objects this property will hold. o $flags (Glib::ParamFlags) paramspec = Glib::ParamSpec->char ($name, $nick, $blurb, $minimum, $maximum, $default_value, $flags) o $name (string) o $nick (string) o $blurb (string) o $minimum (integer) o $maximum (integer) o $default_value (integer) o $flags (Glib::ParamFlags) scalar = $pspec->get_default_value (This is the C level "g_param_value_set_default" function.) Note that on a "Glib::Param::Unichar" the return is a single-char string. This is the same as the constructor "Glib::ParamSpec->unichar", but it's not the same as "Glib::Object" "get_property" / "set_property", so an "ord()" conversion is needed if passing the default value to a unichar "set_property". paramspec = Glib::ParamSpec->double ($name, $nick, $blurb, $minimum, $maximum, $default_value, $flags) o $name (string) o $nick (string) o $blurb (string) o $minimum (double) o $maximum (double) o $default_value (double) o $flags (Glib::ParamFlags) paramspec = Glib::ParamSpec->enum ($name, $nick, $blurb, $enum_type, $default_value, $flags) o $name (string) o $nick (string) o $blurb (string) o $enum_type (string) o $default_value (scalar) o $flags (Glib::ParamFlags) paramspec = Glib::ParamSpec->flags ($name, $nick, $blurb, $flags_type, $default_value, $flags) o $name (string) o $nick (string) o $blurb (string) o $flags_type (string) o $default_value (scalar) o $flags (Glib::ParamFlags) paramflags = $pspec->get_flags paramspec = Glib::ParamSpec->float ($name, $nick, $blurb, $minimum, $maximum, $default_value, $flags) o $name (string) o $nick (string) o $blurb (string) o $minimum (double) o $maximum (double) o $default_value (double) o $flags (Glib::ParamFlags) paramspec = Glib::ParamSpec->gtype ($name, $nick, $blurb, $is_a_type, $flags) o $name (string) o $nick (string) o $blurb (string) o $is_a_type (string or undef) The name of a class whose subtypes are allowed as values of the property. Use "undef" to allow any type. o $flags (Glib::ParamFlags) Since: glib 2.10 paramspec = Glib::ParamSpec->int ($name, $nick, $blurb, $minimum, $maximum, $default_value, $flags) o $name (string) o $nick (string) o $blurb (string) o $minimum (integer) o $maximum (integer) o $default_value (integer) o $flags (Glib::ParamFlags) paramspec = Glib::ParamSpec->int64 ($name, $nick, $blurb, $minimum, $maximum, $default_value, $flags) o $name (string) o $nick (string) o $blurb (string) o $minimum (64 bit integer) o $maximum (64 bit integer) o $default_value (64 bit integer) o $flags (Glib::ParamFlags) paramspec = Glib::ParamSpec->long ($name, $nick, $blurb, $minimum, $maximum, $default_value, $flags) o $name (string) o $nick (string) o $blurb (string) o $minimum (integer) o $maximum (integer) o $default_value (integer) o $flags (Glib::ParamFlags) string = $paramspec->get_name Dashes in the name are converted to underscores. string = $pspec->get_nick paramspec = Glib::ParamSpec->object ($name, $nick, $blurb, $package, $flags) o $name (string) o $nick (string) o $blurb (string) o $package (string) name of the class, derived from Glib::Object, of the objects this property will hold. o $flags (Glib::ParamFlags) paramspec = Glib::ParamSpec->override ($name, $overridden) o $name (string) o $overridden (Glib::ParamSpec) Since: glib 2.4 string = $pspec->get_owner_type paramspec = Glib::ParamSpec->param_spec ($name, $nick, $blurb, $package, $flags) o $name (string) o $nick (string) o $blurb (string) o $package (string) name of the class, derived from Glib::ParamSpec, of the objects this property will hold. o $flags (Glib::ParamFlags) paramspec or undef = $pspec->get_redirect_target Since: glib 2.4 paramspec = Glib::ParamSpec->scalar ($name, $nick, $blurb, $flags) o $name (string) o $nick (string) o $blurb (string) o $flags (Glib::ParamFlags) ParamSpec to be used for any generic perl scalar, including references to complex objects. Currently "Gtk2::Builder" cannot set object properties of this type (there's no hooks for property value parsing, as of Gtk 2.20), so prefer the builtin types if buildable support for an object matters. A "boxed" of "Glib::Strv" can give an array of strings. A signal handler callback can do most of what a coderef might. paramspec = Glib::ParamSpec->string ($name, $nick, $blurb, $default_value, $flags) o $name (string) o $nick (string) o $blurb (string) o $default_value (string or undef) o $flags (Glib::ParamFlags) paramspec = Glib::ParamSpec->uchar ($name, $nick, $blurb, $minimum, $maximum, $default_value, $flags) o $name (string) o $nick (string) o $blurb (string) o $minimum (unsigned) o $maximum (unsigned) o $default_value (unsigned) o $flags (Glib::ParamFlags) paramspec = Glib::ParamSpec->uint ($name, $nick, $blurb, $minimum, $maximum, $default_value, $flags) o $name (string) o $nick (string) o $blurb (string) o $minimum (unsigned) o $maximum (unsigned) o $default_value (unsigned) o $flags (Glib::ParamFlags) paramspec = Glib::ParamSpec->uint64 ($name, $nick, $blurb, $minimum, $maximum, $default_value, $flags) o $name (string) o $nick (string) o $blurb (string) o $minimum (64 bit unsigned) o $maximum (64 bit unsigned) o $default_value (64 bit unsigned) o $flags (Glib::ParamFlags) paramspec = Glib::ParamSpec->ulong ($name, $nick, $blurb, $minimum, $maximum, $default_value, $flags) o $name (string) o $nick (string) o $blurb (string) o $minimum (unsigned) o $maximum (unsigned) o $default_value (unsigned) o $flags (Glib::ParamFlags) paramspec = Glib::ParamSpec->unichar ($name, $nick, $blurb, $default_value, $flags) o $name (string) o $nick (string) o $blurb (string) o $default_value (character) o $flags (Glib::ParamFlags) string = $pspec->get_value_type bool = $paramspec->value_validate ($value) (bool, newval) = $paramspec->value_validate ($value) o $value (scalar) In scalar context return true if $value must be modified to be valid for $paramspec, or false if it's valid already. In array context return also a new value which is $value made valid. $value must be the right type for $paramspec (with usual stringizing, numizing, etc). "value_validate" checks the further restrictions such as minimum and maximum for a numeric type or allowed characters in a string. The "made valid" return is then for instance clamped to the min/max, or offending chars replaced by a substitutor. integer = $pspec->values_cmp ($value1, $value2) o $value1 (scalar) o $value2 (scalar) Compares value1 with value2 according to pspec, and returns -1, 0 or +1, if value1 is found to be less than, equal to or greater than value2, respectively. ENUMS AND FLAGS
flags Glib::ParamFlags o 'readable' / 'G_PARAM_READABLE' o 'writable' / 'G_PARAM_WRITABLE' o 'construct' / 'G_PARAM_CONSTRUCT' o 'construct-only' / 'G_PARAM_CONSTRUCT_ONLY' o 'lax-validation' / 'G_PARAM_LAX_VALIDATION' o 'private' / 'G_PARAM_PRIVATE' SEE ALSO
Glib COPYRIGHT
Copyright (C) 2003-2011 by the gtk2-perl team. This software is licensed under the LGPL. See Glib for a full notice. perl v5.14.2 2012-05-24 Glib::ParamSpec(3pm)
All times are GMT -4. The time now is 04:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy