Sponsored Content
Top Forums UNIX for Advanced & Expert Users MV files from one directory structure(multiple level) to other directory structure Post 302088435 by tayyabq8 on Tuesday 12th of September 2006 10:52:21 AM
Old 09-12-2006
I don't know what you are trying to do, I think you want something like this:
Code:
find /path -type d -mtime +5 -print | xargs rm -r

But be careful with above command.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

disk space used for files with in a directory structure.

Hello, I am new to shell scripting and would really appreciate if someone could help me with this question. I have a directory structure as follows.. main directory is DATA under which i have different directories names fileserver01, fileserver02 ... till fileserver 15. under each... (8 Replies)
Discussion started by: kasala
8 Replies

2. UNIX for Dummies Questions & Answers

Copying a Directory Structure to a new structure

Hi all Is it possible to copy a structure of a directory only. e.g. I have a file with the following entries that is a result of a find :- /dir1/dir2/file.dbf /dir1/dir2/dir3/file1.dbf /dir1/file.dbf I want to copy these to a directory and keep the structure however starting at a new dir... (8 Replies)
Discussion started by: jhansrod
8 Replies

3. UNIX for Dummies Questions & Answers

copy files with directory structure

i have a text file as. /database/sp/NTR_Update_Imsi_List.sql /database/sp/NTR_Update_Imsi_Range_List.sql /database/sp/NTR_Vlr_Upload.sql /database/tables/StatsTables.sql /mib/ntr.mib /mib/ntr.v2.mib /scripts/operations/ntr/IMSITracer.ph /scripts/operations/ntr/IMSITracer.pl ... (3 Replies)
Discussion started by: adddy
3 Replies

4. SCO

Transfer files wih directory structure.

I need to transfer software off a SCO OpenServer 5.0.5 server. I can not seem to read this server's tape on my other server since the tape drive (IBM Gen 5 DAT 72GB) will continuosly "eject" this DAT 8 tape. I have been able to 'tarball' most of the smaller directories with success and... (11 Replies)
Discussion started by: uxlunatick
11 Replies

5. Shell Programming and Scripting

Script to remove all empty files within the directory structure?

Hi I need to write a shell script which basically searches for all the empty files within the directory structure, lists them before asking the user to confirm if they would like to delete them. If the user deletes the file then a notice would appear confirming the file is deleted. I've be... (5 Replies)
Discussion started by: cat123
5 Replies

6. Shell Programming and Scripting

Copying a directory structure with the latest versions of files

Hello I have three directory structures for code releases. Each directory structure looks like this: bash-3.00$ ls -R | more .: Test_Release_1 Test_Release_2 Test_Release_3 ./Test_Release_1/dbcode: rp_online_import_srdp.pkb-1 srdp_ar_validation.pkb-1... (1 Reply)
Discussion started by: Glyn_Mo
1 Replies

7. Shell Programming and Scripting

How to traverse directory structure and sum size of files?

How do I write a bash or ruby or perl or groovy script to print all the files in my directory tree that are one-to-two years old, the size of each file, and the sum of file sizes and then delete them? I was using find . -atime +365 -exec rm '{}' \; but the problem was that I could not... (5 Replies)
Discussion started by: siegfried
5 Replies

8. Shell Programming and Scripting

Extract files from tar ball without directory structure

Hi, I have tar filw which has multiple directories which contain files. When i extract using tar -xf the directory structure also get extracted. I require only files and not directory structures as there will be overhead of moving the files again. So i searched here and got a solution but... (4 Replies)
Discussion started by: chetan.c
4 Replies

9. Shell Programming and Scripting

Archiving files keeping the same structure directory

Hello Team, We would like to backup a lot of files inside of a structure of directories, four, five or more levels in some Ubuntu, Mac and Solaris systems. For instance: /home/chuck/sales/virgin/rent-quote.pdf /home/chuck/sales/marriott/vacation-quote.pdf... (2 Replies)
Discussion started by: csierra
2 Replies
pathchk(1)							   User Commands							pathchk(1)

NAME
pathchk - check path names SYNOPSIS
pathchk [-p] path... DESCRIPTION
The pathchk command will check that one or more path names are valid (that is, they could be used to access or create a file without caus- ing syntax errors) and portable (that is, no filename truncation will result). More extensive portability checks are provided by the -p option. By default, pathchk will check each component of each path operand based on the underlying file system. A diagnostic will be written for each path operand that: o is longer than PATH_MAX bytes. o contains any component longer than NAME_MAX bytes in its containing directory o contains any component in a directory that is not searchable o contains any character in any component that is not valid in its containing directory. The format of the diagnostic message is not specified, but will indicate the error detected and the corresponding path operand. It will not be considered an error if one or more components of a path operand do not exist as long as a file matching the path name speci- fied by the missing components could be created that does not violate any of the checks specified above. OPTIONS
The following option is supported: -p Instead of performing checks based on the underlying file system, write a diagnostic for each path operand that: o is longer than _POSIX_PATH_MAX bytes o contains any component longer than _POSIX_NAME_MAX bytes o contains any character in any component that is not in the portable filename character set. OPERANDS
The following operand is supported: path A path to be checked. USAGE
See largefile(5) for the description of the behavior of pathchk when encountering files greater than or equal to 2 Gbyte ( 2**31 bytes). EXAMPLES
Example 1: Using the pathchk command To verify that all paths in an imported data interchange archive are legitimate and unambiguous on the current system: example% pax -f archive | sed -e '/ == .*/s///' | xargs pathchk if [ $? -eq 0 ] then pax -r -f archive else echo Investigate problems before importing files. exit 1 fi To verify that all files in the current directory hierarchy could be moved to any system conforming to the X/Open specification that also supports the pax(1) command: example% find . -print | xargs pathchk -p if [ $? -eq 0 ] then pax -w -f archive . else echo Portable archive cannot be created. exit 1 fi To verify that a user-supplied path names a readable file and that the application can create a file extending the given path without trun- cation and without overwriting any existing file: example% case $- in *C*) reset="";; *) reset="set +C" set -C;; esac test -r "$path" && pathchk "$path.out" && rm "$path.out" > "$path.out" if [ $? -ne 0 ]; then printf "%s: %s not found or %s.out fails creation checks. " $0 "$path" "$path" $reset # reset the noclobber option in case a trap # on EXIT depends on it exit 1 fi $reset PROCESSING < "$path" > "$path.out" The following assumptions are made in this example: 1. PROCESSING represents the code that will be used by the application to use $path once it is verified that $path.out will work as intended. 2. The state of the noclobber option is unknown when this code is invoked and should be set on exit to the state it was in when this code was invoked. (The reset variable is used in this example to restore the initial state.) 3. Note the usage of: rm "$path.out" > "$path.out" a. The pathchk command has already verified, at this point, that $path.out will not be truncated. b. With the noclobber option set, the shell will verify that $path.out does not already exist before invoking rm. c. If the shell succeeded in creating $path.out, rm will remove it so that the application can create the file again in the PRO- CESSING step. d. If the PROCESSING step wants the file to exist already when it is invoked, the: rm "$path.out" > "$path.out" should be replaced with: > "$path.out" which will verify that the file did not already exist, but leave $path.out in place for use by PROCESSING. ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of pathchk: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH. EXIT STATUS
The following exit values are returned: 0 All path operands passed all of the checks. >0 An error occurred. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
pax(1), test(1), attributes(5), environ(5), largefile(5), standards(5) SunOS 5.10 1 Feb 1995 pathchk(1)
All times are GMT -4. The time now is 07:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy