Sponsored Content
Full Discussion: Copy file only if newer
Top Forums Shell Programming and Scripting Copy file only if newer Post 303024493 by MadeInGermany on Wednesday 10th of October 2018 02:06:04 AM
Old 10-10-2018
A solution to the problem mentioned in post#3 - a timestamp file.
Code:
last_bu=$DOCS_Backup/last_backup
if [[ ! -f $last_bu ] || [[ Ubuntu_Documents.zip -nt $last_bu ]]
then
  cp Ubuntu_Documents.zip $DOCS_Backup/Ubuntu_Documents_`date +"%Y-%m-%d-%H-%M"`.zip &&
  >$last_bu
fi

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

tar --newer = tar --newer-mtime ?

Hi, I have the following question : As far as I know unix doesn't store file creation dates. Would that imply the following? tar -cvzf backup.tar --newer is equal to: tar -cvzf backup.tar --newer-mtime ? (1 Reply)
Discussion started by: jamesbond
1 Replies

2. Shell Programming and Scripting

copy only newer files? (xcopy equivalent)

Howdy folks. I have a problem - I'm sure the answer is very simple, but I can't work it out. I want to create a UNIX shell script that does what I've been doing in DOS batch files for years - that is, backing up files. By which I mean copying files from a source directory to a target... (4 Replies)
Discussion started by: Chomps
4 Replies

3. Solaris

To copy the files newer than specific date

Dear all, Can you help me in copying files newer than speciifc date Thanks in advance, Rajesh (3 Replies)
Discussion started by: RAJESHKANNA
3 Replies

4. Shell Programming and Scripting

Copy newer files without create

I want the same effect as "cp -u" but without create missing files, it is possible ? ps: bash (2 Replies)
Discussion started by: mrxrsd
2 Replies

5. Shell Programming and Scripting

If condition to check one file newer than the other - first file name uncertain

Dear All, I'm new to unix scripting. I'm trying to write an utility script which has to check if one file is newer than another one. The condition is I dont know the full name of the first file. I searched google and this forum for any such examples, but couldn't find any or may be I would have... (9 Replies)
Discussion started by: achilles5
9 Replies

6. Shell Programming and Scripting

How to script to find the newer date in a text file?

Hi, I have a text file, foo.txt, it looks something like below. In the file there is a line that gives the date in the form of: Mon Jun 15 11:09:31 2008. I need to find which date is the newest and then store certain details of that list data to another file. So, in this sample text file, I... (6 Replies)
Discussion started by: boolean2222
6 Replies

7. Shell Programming and Scripting

how to find a file then overwrite with a newer version

This should be a simple script, but can't find one with google search. I just need to find the file that is in many directories, then overwrite that file with a newer version i.e. find file.jar then overwrite with /root/file.jar All I get in searches is substitute text with new test inside... (1 Reply)
Discussion started by: haircat
1 Replies

8. Shell Programming and Scripting

Perl script, replace file with newer file

Hello, Can you please help me one this: I have two servers: Server A and server B. Every day on 03.00AM in only one on these two servers (randomly)is generated one file, lets say file.txt. I want to copy this file also to the other server. I want to create a perl script that does... (2 Replies)
Discussion started by: arrals_vl
2 Replies

9. UNIX for Dummies Questions & Answers

If condition to check one file newer than the other

Dear All, I'm new to unix scripting. I'm trying to write an utility script which has to check if one file is newer than another one. $3 $4 $5 $6 are files .txt. Help me please. for i in $3 $4 $5 $6 do if then echo "$1 is newer than $i" else echo "$i is newer than $1" fi (9 Replies)
Discussion started by: Manueldo
9 Replies
ZIP_ENTRY_OPEN(3)							 1							 ZIP_ENTRY_OPEN(3)

zip_entry_open - Open a directory entry for reading

SYNOPSIS
bool zip_entry_open (resource $zip, resource $zip_entry, [string $mode]) DESCRIPTION
Opens a directory entry in a zip file for reading. PARAMETERS
o $zip - A valid resource handle returned by zip_open(3). o $zip_entry - A directory entry returned by zip_read(3). o $mode - Any of the modes specified in the documentation of fopen(3). Note Currently, $mode is ignored and is always "rb". This is due to the fact that zip support in PHP is read only access. RETURN VALUES
Returns TRUE on success or FALSE on failure. Note Unlike fopen(3) and other similar functions, the return value of zip_entry_open(3) only indicates the result of the operation and is not needed for reading or closing the directory entry. SEE ALSO
zip_entry_close(3), zip_entry_read(3). PHP Documentation Group ZIP_ENTRY_OPEN(3)
All times are GMT -4. The time now is 08:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy