Sponsored Content
Top Forums Shell Programming and Scripting Copying a files from a filter list and creating their associated parent directories Post 302418470 by hunter55 on Tuesday 4th of May 2010 11:07:29 AM
Old 05-04-2010
Copying a files from a filter list and creating their associated parent directories

Hello all,

I'm trying to copy all files within a specified directory to another location based on a find filter of mtime -1 (Solaris OS). The issue that I'm having is that in the destination directory, I want to retain the source directory structure while copying over only the files that have been modified within 24 hours (so cp -r option is out).

For example, if I've got the following directory structure as my source

Code:
/datafiles
/datafiles/a/a1.txt (mod 12 hours ago) 
/datafiles/a/a2.txt (mod 36 hours ago)
/datafiles/b/b1.txt (mod 36 hours ago)
/datafiles/b/b2.txt (mod 12 hours ago)

And my target is /modfiles, then after the copy I would want the following:

Code:
/modfiles/datafiles/a/a1.txt
/modfiles/datafiles/b/b2.txt

I'm trying:

Code:
find /datafiles -mtime -1 -exec cp '{}' /modfiles \;

I'm trying to avoid having to use TAR for this to maintain the directory structure but it's starting to look like my only option. Any ideas?

Thanks!

Last edited by Scott; 05-05-2010 at 05:25 PM.. Reason: Code tags please...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Backup script: Copying and removing directories based on list

I am writing a simple backup script, but I cannot figure out how to remove directories that are found in a list. For example: DONT_COPY=" .adobe/ .bin/google-earth " tar -zcvf - * --exclude=$DONT_COPY | openssl des3 -salt -k $1 | dd of=$(hostname)-$(date +%Y%m%d).tbz > COPIED Note that... (4 Replies)
Discussion started by: dotancohen
4 Replies

2. UNIX for Dummies Questions & Answers

List directories and sub directories recursively excluding files

Hi, Please help me, how to get all the direcotries, its sub directories and its sub directories recursively, need to exclude all the files in the process. I wanted to disply using a unix command all the directories recursively excluding files. I tried 'ls -FR' but that display files as... (3 Replies)
Discussion started by: pointers
3 Replies

3. Shell Programming and Scripting

Moving files from several directories into parent

I am fairly new to bash(but am proficient in C++), and have only completed a few simple scripts. This is my first script that I actually need to do a serious task. All of my audiobooks are stored in traditional MP3 format: Music/Artist/Album/*.mp3 (which in this case is... (0 Replies)
Discussion started by: gamendorf
0 Replies

4. UNIX for Dummies Questions & Answers

Creating named directories from a list of names

Hi There, I'm a competent computer user that is learning basic unix commands. This is a slightly hypothetical question (for now at least!) but I can see a need for doing something like this in the near future. So I recently learned this command mkdir foo{1..100} which of course create's... (4 Replies)
Discussion started by: lookslikejames
4 Replies

5. Shell Programming and Scripting

How to list all the files, directories and sub-directories in the current path except one directory?

Can anyone come up with a unix command that lists all the files, directories and sub-directories in the current directory except a folder called log.? Thank you in advance. (7 Replies)
Discussion started by: Manjunath B
7 Replies

6. Shell Programming and Scripting

Copying the files after filter

Hi Guys, i want copy the all files another direcotry after filtering the command. and tried as like below...it's not working. ls -ltr|awk '{print $9}'|grep "images\|\.htm"|cp *.* /home/oracle Thanks (13 Replies)
Discussion started by: bmk
13 Replies

7. Shell Programming and Scripting

Copying data from files to directories

I have the following that I'd like to do: 1. I have split a file into separate files that I placed into the /tmp directory. These files are named F1 F2 F3 F4. 2. In addition, I have several directories which are alphabetized as dira dirb dirc dird. 3. I'd like to be able to copy F1 F2 F3 F4... (2 Replies)
Discussion started by: newbie2010
2 Replies

8. Shell Programming and Scripting

Copying files from parent directory only

Hello, Please can someone assist on a issue I am having. I want to find specific files in the parent directory only that have been modified over the last 2 days and copy them to another location. NOTE: The version of AIX I am using does not have MAXDEPTH. I have currently written the... (3 Replies)
Discussion started by: Dolph
3 Replies

9. Shell Programming and Scripting

Archiving and moving files into directories, creating directories, etc.

how can i move "dataName".sql.gz into a folder called 'database' and then move "$fileName".tar.gz * .htaccess into a folder called 'www' with the entire gzipped file being "$fileName".tar.gz? Is this doable or overly complex. so mydemo--2015-03-23-1500.tar.gz > database -... (5 Replies)
Discussion started by: wyclef
5 Replies

10. Shell Programming and Scripting

Copying files to directories based on first 6 character

guys, i did create a script but its too long, though it function the same. # cat nightlyscan.sh #!/usr/ksh deyt=`date +"%Y-%m-%d"` for i in `ls -lrt|grep $deyt|awk '{print $9}'` do cp -f $i /S1/Sophos/logger/ done # but i did not paste it all. this is the desired. (9 Replies)
Discussion started by: kenshinhimura
9 Replies
mime.convs(5)							    Apple Inc.							     mime.convs(5)

NAME
mime.convs - mime type conversion file for cups DESCRIPTION
The mime.convs file defines the filters that are available for converting files from one format to another. The standard filters support text, PDF, PostScript, and many types of image files. Additional filters are specified in files with the extension .convs in the CUPS configuration directory. Each line in the mime.convs file is a comment, blank, or filter line. Comment lines start with the # character. Filter lines specify the source and destination MIME types along with a relative cost associated with the filter and the filter to run: source/type destination/type cost filter The source/type field specifies the source MIME media type that is consumed by the filter. The destination/type field specifies the destination MIME media type that is produced by the filter. The cost field specifies the relative cost for running the filter. A value of 100 means that the filter uses a large amount of resources while a value of 0 means that the filter uses very few resources. The filter field specifies the filter program filename. Filenames are relative to the CUPS filter directory. FILES
/etc/cups - Typical CUPS configuration directory. /usr/lib/cups/filter - Typical CUPS filter directory. /usr/libexec/cups/filter - CUPS filter directory on macOS. EXAMPLES
Define a filter that converts PostScript documents to CUPS Raster format: application/vnd.cups-postscript application/vnd.cups-raster 50 pstoraster SEE ALSO
cups-files.conf(5), cupsd.conf(5), cupsd(8), cupsfilter(8), mime.types(5), CUPS Online Help (http://localhost:631/help) COPYRIGHT
Copyright (C) 2007-2017 by Apple Inc. 26 August 2015 CUPS mime.convs(5)
All times are GMT -4. The time now is 10:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy