Sponsored Content
Top Forums Shell Programming and Scripting How to move the files older than x days with similar directory structure? Post 302917747 by prvnrk on Thursday 18th of September 2014 11:40:58 AM
Old 09-18-2014
How to move the files older than x days with similar directory structure?

Hello,

I need to move all the files inside /XYZ (has multi-depth sub directories) that are older than 14 days to/ABC directory but with retaining the SAME directory structure.

for example:
/XYZ/1/2/3/A/b.txt should be moved as /ABC/1/2/3/A/b.txt

I know about find /XYZ -type f -mtime +14 -exec mv {} /ABC \; but it would NOT retain the directory structure.

I thought of backing up whole /XYZ to /ABC and then delete recent 14 days' files from /ABC and all files older than 14 days from /XYZ but I find it very inefficient.

Appreciate any help. Thanks!
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

MV files from one directory structure(multiple level) to other directory structure

Hi, I am trying to write a script that will move all the files from source directory structure(multiple levels might exist) to destination directory structure. If a sub folder is source doesnot exist in destination then I have to skip and goto next level. I also need to delete the files in... (4 Replies)
Discussion started by: srmadab
4 Replies

2. Shell Programming and Scripting

List directory 7 days older

Say folder archive/ contains many folder each created on a day. this folder may contain files. i want to write a script to delete all the folder inside archive/ which are 7 days older. i used the below script for the reason. find archive -mtime +7 -type d -exec rm -r {} \; pls suggest me if... (3 Replies)
Discussion started by: krishnarao
3 Replies

3. Shell Programming and Scripting

Move the latest or older File from one directory to another Directory

I Need help for one requirement, I want to move the latest/Older file in the folder to another file. File have the datetimestamp in postfix. Example: Source Directory : \a destination Directory : \a\b File1 : xy_MMDDYYYYHHMM.txt (xy_032120101456.txt) File2: xy_MMDDYYYYHHMM.txt... (1 Reply)
Discussion started by: pp_ayyanar
1 Replies

4. UNIX for Dummies Questions & Answers

move files older than 2 days to another folder

Hi I am facing problem in using this command, mv `find /export/june/PURGEDATA*.txt -mtime +2 -exec ls {} \;` june/archive/ mv: Insufficient arguments (1) Usage: mv f1 f2 mv f1 ... fn d1 mv d1 d2 Thank you in advance (2 Replies)
Discussion started by: vishwakar
2 Replies

5. Shell Programming and Scripting

Delete files older than 10 Days in a directory

Hi All I want to remove the files with name like data*.csv from the directory older than 10 days. If there is no files exists to remove older than 10 days, It should not do anything. Thanks Jo (9 Replies)
Discussion started by: rajeshjohney
9 Replies

6. AIX

Want to delete directory, subdirectories and all files which are older than 7 days

how do i remove sub directories of a directory and all files which are older than 7 days by a single command in AIX. pls help me. I am using command as #find /gpfs1/home/vinod/hpc/ -depth -type d -mtime +7 -exec rm -rf {} \; so i want to delete all sub directories and all files from the... (1 Reply)
Discussion started by: vinodkmpal
1 Replies

7. UNIX for Advanced & Expert Users

HPUX move files older than 30 days

Hello, I have a script which finds files in a directory that are older than 30 days and moves them to the specified directory. The problem is I don't know why it works the way it does? Code: find . -name '*.sql' ! -mtime -30 -exec mv '{}' /dataload/archivelogs \; I was under the... (4 Replies)
Discussion started by: pure_jax
4 Replies

8. Shell Programming and Scripting

How can i move folders and its content if folder is older than 1,5 days and keep subdirs in bash?

Hello all, do you know any way i can i move folders and its content if folder is older than 1,5 days in bash? I tried: find /home/xyz/DATA/* -type d -ctime +1.5 -exec mv "{}" /home/xyz/move_data_here/ \;All i got was that Files from DATA /home/xyz/DATA/* ended messed up in... (1 Reply)
Discussion started by: ZerO13
1 Replies

9. Linux

Finding files older than x days within directory with spaces

Hi, I am trying to run a command that finds all files over x amount of days, issue is one of the directories has spaces within it. find /files/target directory/*/* -type f -mtime +60 When running the above the usual error message is thrown back + find '/files/target\' 'directory/*/*' -type... (1 Reply)
Discussion started by: Ads89
1 Replies
scsi_vhci(7D)							      Devices							     scsi_vhci(7D)

NAME
scsi_vhci - SCSI virtual host controller interconnect driver DESCRIPTION
The scsi_vhci driver is a SCSA compliant pseudo nexus driver that supports Solaris operating system I/O multipathing services for SCSI-3 devices. This driver introduces a fundamental restructuring of the Solaris device tree to enable a multipath device to be represented as single device instance rather than as an instance per physical path as in earlier Solaris versions. The multipath SCSI target devices managed by this driver are identified and represented by using SCSI-3 VPD page(0x83) as the device's unit address. Symbolic links in /dev/[r]dsk continue to adhere to the cNtNdNsN format. cN is the logical controller number assigned to this driver instance. tN is the global unique identifier (GUID) of the multipath target device (64/128 bits), represented as hexadecimal numbers. The following is an example of a system with a A5000 storage array: ... /dev/rdsk/c4t200000203709C3F5d0s0 -> ../../devices/scsi_vhci/ ssd@g200000203709c3f5:a,raw ... /dev/rdsk/c4t200000203709C3F5d0s7 -> ../../devices/scsi_vhci/ ssd@g200000203709c3f5:h,ra ... The following is an example of a system with a T300 storage array: ... /dev/rdsk/c1t60020F200000033939C2C2B60008D4AEd0s0 -> ../../devices/ scsi_vhci/ssd@g60020f200000033939a2c2b60008d4ae:a,raw ... /dev/rdsk/c1t60020F200000033939A2C2B60008D4AEd0s7 -> ../../devices/ scsi_vhci/ssd@g60020f200000033939a2c2b60008d4ae:h,raw The scsi_vhci driver receives naming and transport services from one or more physical HBA (host bus adapter) devices. To support multi- pathing, a physical HBA driver must comply with the multipathing services provided by this driver. The scsi_vhci driver supports the standard functions provided by the SCSA interface. Configuration The scsi_vhci driver can be configured by defining properties in the scsi_vhci.conf file. The scsi_vhci driver supports the following property: device-type-scsi-options-list To add a third-party (non-Sun) symmetric storage device to run under scsi_vhci (and thereby take advantage of Solaris I/O multipathing), you add the vendor ID and product ID for the device, as those strings are returned by the SCSI Inquiry command. As shipped, the scsi_vhci.conf file contains, in part: # device-type-scsi-options-list = # "SUN SENA", "symmetric-option"; # symmetric-option=0x1000000; For example,to add a device from a vendor with the ID of "Acme" and a product ID of "MSU", you would add: device-type-scsi-options-list = "Acme MSU", "symmetric-option"; symmetric-option=0x1000000; In addition to "Acme," you also might want to add another entry, for example, a device from "XYZ" vendor with a product ID of "ABC:" device-type-scsi-options-list = "Acme MSU", "symmetric-option", "XYZ ABC", "symmetric-option"; symmetric-option=0x1000000; FILES
/kernel/drv/sparcv9/scsi_vhci 64-bit kernel module (SPARC). /kernel/drv/scsi_vhci 32-bit kernel module (x86). /kernel/drv/scsi_vhci.conf Driver configuration file. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Architecture |PCI-based systems | +-----------------------------+-----------------------------+ |Availability |SUNWckr | +-----------------------------+-----------------------------+ SEE ALSO
eeprom(1M), prtconf(1M), attributes(5), fcp(7D), fctl(7D), fp(7D), ssd(7D), scsi_abort(9F), scsi_ifgetcap(9F), scsi_pkt(9S), scsi_reset(9F), scsi_transport(9F), scsi_inquiry(9S), scsi_extended_sense(9S) Writing Device Drivers Small Computer System Interface-3 (SCSI-3) NOTES
In previous releases, the scsi_vhci.conf file supported the mpxio-disable property, which allowed you to disable Solaris I/O multipathing on a system-wide basis. This property is not present in the current release of the Solaris operating system. Multipathing is always enabled in scsi_vhci. If you want to disable multipathing, use the mechanisms provided by the HBA drivers. See fp(7D). In previous releases, Solaris I/O multipathing was also known as MPxIO and Sun StorEdge Traffic Manager (STMS). SunOS 5.10 2 Dec 2004 scsi_vhci(7D)
All times are GMT -4. The time now is 12:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy