Sponsored Content
Top Forums Shell Programming and Scripting Copying latest file into a folder Post 302301391 by TonyFullerMalv on Thursday 26th of March 2009 06:14:51 PM
Old 03-26-2009
Put a set -x at the top of the script and run it in a terminal window to see what it is doing, a sleep of some period just before the done might be advisable (say 3 seconds?)

If the set -x spits out too much on the screen then put:
Code:
echo PREVLATEST = ${PREVLATEST} LATEST = ${LATEST}

before the if line and put:
Code:
echo cp "/var/Folder1/${LATEST}" "/var/Folder2/${LATEST}"

before the actual copy line instead of using set -x.

To run it as a daemon from within a terminal window you can do:
Code:
# nohup ./script.sh &

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Copying files with the latest date

Hi All, I have a situation where I need to copy the files having the latest date. For example I have a file by name bas100e1_jun05. I need to copy it to bas100e1. But when a file by name bas100e1_jul05 is put in the same directory the script should copy the file having the latest month which... (34 Replies)
Discussion started by: shashi_kiran_v
34 Replies

2. UNIX for Dummies Questions & Answers

Copy the latest file from a folder

Hi, I have a problem. I have some text files in a folder. The names can be like: emp_20080307053015.dat emp_20080306053015.dat emp_20080305053015.dat emp_20080304053015.dat The date format appended is like yyyymmdd and timestamp. What i need is i have to copy the latest file every... (3 Replies)
Discussion started by: Aswarth
3 Replies

3. Shell Programming and Scripting

copying the latest file

Hi, I have a problem. I have some text files in a folder. The names can be like: emp_20080307053015.dat emp_20080306053015.dat emp_20080305053015.dat emp_20080304053015.dat The date format appended is like yyyymmdd and timestamp. What i need is i have to copy the latest file every... (12 Replies)
Discussion started by: Aswarth
12 Replies

4. Shell Programming and Scripting

script for Finding files in a folder and copying to another folder

Hi all, I have a folder '/samplefolder' in which i have some files like data0.txt, data1.txt and data2.txt. I have to search the folder for existence of the file data0.txt first and if found have to copy it to some other file; next i have to search the folder for existence of file... (5 Replies)
Discussion started by: satish2712
5 Replies

5. UNIX for Dummies Questions & Answers

Copy the latest (last file) in given folder

#!/bin/bash for i in {1..1536..1} do #find /home/test/Desktop/up111/workplace/Malware/$i/logs for a in /home/test/Desktop/up111/workplace/Malware/$i/logs/* do #max=a for b in /home/test/Desktop/up111/workplace/Malware/$i/logs/* do ... (4 Replies)
Discussion started by: upvan111
4 Replies

6. UNIX and Linux Applications

Need to copy the latest file from Unix server to Shared folder

Hi All, One job in unix server will generate .csv files daily. I need to copy the latest of these .csv file from the unix server to the shared drive/folder in windows through unix script. My shared folder will look something like W:\some folder(for example). Could any one of you please help... (3 Replies)
Discussion started by: jaya@123
3 Replies

7. Shell Programming and Scripting

Perl : copying only the latest file to other directory

In linux.. In a directory there are 3 files which I want to copy only the latest file (ls -ltr myfiles*.txt|tail -1) to other directory in perl? Could anyone please help me with the code? Regards, J (1 Reply)
Discussion started by: scriptscript
1 Replies

8. UNIX for Dummies Questions & Answers

Copying a file based on a incremented folder name

I need to routinely cp a file out of the highest incremented folder named PROD_2_6.1_xxx where xxx (3 numerical values) is incremented only once a night starting at 100 and ending 999 over a period of time. I am not worried about copying a subset of a complete file while it is being created by some... (5 Replies)
Discussion started by: sf_cb
5 Replies

9. UNIX for Beginners Questions & Answers

Retrieve the Latest file in a folder using SFTP

HI Guys, Can anyone help me to retrieve the latest file from below example using SFTP I have below list of files in a folder v403t.lstprgms.sortin1 val027.d099.fwest.oct2711 xcelrptd.d1400sqp.dec1713.t040459.@02del xcelrptd.d1400sqp.dec1713.t073308.@02del... (3 Replies)
Discussion started by: heye18
3 Replies
PKGKDE-OVERRIDE-SC-DEV-LATEST(1)			User Contributed Perl Documentation			  PKGKDE-OVERRIDE-SC-DEV-LATEST(1)

NAME
pkgkde-override-sc-dev-latest - loosen kde-sc-dev-latest Break restrictions SYNOPSIS
pkgkde-override-sc-dev [-bbase_version] [-vversion] DESCRIPTION
pkgkde-override-sc-dev-lastest is a helper utility which can be used to generate a dummy kde-sc-dev-latest package without Breaks field that is present in the original version. Original kde-sc-dev-latest package is used to force KDE Software Compilation modules to be built against the latest version of the KDE Development Platform modules without bumping versions of a bunch build dependencies for each KDE SC module. However, while original kde-sc-dev-latest does not cause problems when building in clean chroots, the restrictions imposed by its Breaks field might be undesirable on the maintainer system when: o the maintainer wants to (test)build KDE module version X.Y.A against KDE Development Platform X.Y.B where (A > B); o the maintainer builds a new upstream version of the some KDE Development Platform module on the system that has an old version of some KDE Development Platform packages installed. For example, even if kdepimlibs does not build depend on kdebase-workspace-dev, original kde-sc-dev-latest may prevent kdepimlibs X.Y.A to be built on the system which has kdebase-workspace X.Y.B (where A > B) installed. By default, pkgkde-override-sc-dev-latest generates a dummy kde-sc-dev-latest package in the current working directory that is based on the current "candidate" version of the original kde-sc-dev-latest (as per apt-cache policy). You may specify a base version with the -b option. The resulting dummy kde-sc-dev-latest override package will have "base_version+override" as its version unless another one is specified with -v option. Once the package is generated, you can install it like: # dpkg --install kde-sc-dev_<version>+override_all.deb OPTIONS
-bbase_version, --basever=base_version The version of the original kde-sc-dev-latest package to base an override package on. It must be available in the APT database on the system. You may also pass special value "latest" to select the latest available version in the APT database. If you specify "priority", the latest version with the highest priority will be selection. By default (if this option is not specified), candidate version is selected -vversion, --version=version Generate an override package with the specified "version+override" rather than default "base_version+override" version. AUTHOR
Modestas Vainius <modax@debian.org> perl v5.14.2 2011-12-26 PKGKDE-OVERRIDE-SC-DEV-LATEST(1)
All times are GMT -4. The time now is 06:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy