Sponsored Content
Top Forums UNIX for Dummies Questions & Answers [SOLVED] Copy subfolder to another directory preserving parent name Post 302854035 by alex2005 on Monday 16th of September 2013 03:38:25 PM
Old 09-16-2013
[SOLVED] Copy subfolder to another directory preserving parent name

Hi,

I have the following folder structure:

Code:
Folder6100/Data
Folder6100/Data
Folder6120/Data
Folder6120/Data
Folder6140/Data
Folder6140/Data
Folder6160/Data
Folder6160/Data
Folder6180/Data
Folder6180/Data
Folder6200/Data
Folder6220/Data
Folder6240/Data
Folder6260/Data
Folder6280/Data
Folder6300/Data
Folder6320/Data
Folder6340/Data
Folder6360/Data
Folder6380/Data
Folder6400/Data
Folder6420/Data
Folder6440/Data
Folder6460/Data
Folder6480/Data
Folder6500/Data

I would like to copy all files under
Code:
Folder61[6-8]*/Data Folder63[2-6]*/Data

to an external disk
Code:
"/media/My Disk"

.

Using the following command :
Code:
cp -rpv Folder61[6-8]*/Data Folder63[2-6]*/Data "/media/My Disk"

creates on the external disk the Data folder and copy all the files in this directory.

What command can I use in order to preserve the path?

Desired disk content is:

Code:
Folder6160/Data
Folder6180/Data
Folder6320/Data
Folder6340/Data
Folder6360/Data

I need to copy only Data folder since under FolderXXXX I have some files that don't need to be copied.

Thanks in advance.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to read a subfolder one by one in parent folder?

Hi friends, I am getting some trubles in folder reading. I am having 10 subfolders inside server7 folder. i wanna to read a subfolder name first and check if the foldername gets started with "http". if so , i need to read a file inside that folder. This willl continue for... (1 Reply)
Discussion started by: kamatchirajan
1 Replies

2. UNIX for Dummies Questions & Answers

create tar archive without preserving directory structure?

I am adding some individual files to a tar archive and would like them to be added to the archive without any directory hierarchy, even though the files themselves exist in levels of hierarchy. Unfortunately, tar seems to always preserve the directory hierarchy when it adds the files. Here is... (2 Replies)
Discussion started by: Special_K
2 Replies

3. Shell Programming and Scripting

Get parent directory of a file

In shell how would I get the parent directory of a file. E.g. I feed this in: /path/to/textfile.txt And get just: /path/to Thanks (2 Replies)
Discussion started by: pcwiz
2 Replies

4. UNIX for Dummies Questions & Answers

cd to parent directory

Is there anyway i can cd to the parent directory of my current directory without using .. entries? (6 Replies)
Discussion started by: linux17
6 Replies

5. Shell Programming and Scripting

Link multiple files from different subfolder to a new subfolder

Hi, I have the following subfolder with files: /data/a/1/xxx.txt /data/b/2/yyy.txt /data/c/3/zzz.txt And i have a set of new folders which have exactly the same structure as above but different disk without the files: /data_02/a/1/ /data_02/b/2/ /data_02/c/3/ Now i would like to... (6 Replies)
Discussion started by: total_ysf
6 Replies

6. UNIX for Dummies Questions & Answers

parent and child directory

does anyone know how to check in an 'if' statement if a particular directory is a child directory of a particular directory? help ~ (2 Replies)
Discussion started by: ymc1g11
2 Replies

7. Shell Programming and Scripting

Copy real file from a shortcut preserving the time stamps and directory tree

I have directory with shorcuts of files. for example: gara@yn\short\name1 ( shortcut to gara@yn\FOLDER\OPT\GARA\1.jpg ) gara@yn\short\name2 ( shortcut to gara@yn\FOLDER\OPT\GARA\11.jpg ) gara@yn\short\name3 ( shortcut to gara@yn\MARA\URSA\2.jpg ) gara@yn\short\name4 ( shortcut to... (6 Replies)
Discussion started by: gogok_bg
6 Replies

8. Shell Programming and Scripting

Catching the xml tag when only parent directory is known ..not the actual directory

Hi folks, I have an query that is let say i have to search in an xml file an tag that is <abcdef> now this xml file is at /opt/usr/local so one fastest way to achieve this is go to this location by cd /opt/usr/local and then do grep like this... grep -i abcdef but for this I must know the... (4 Replies)
Discussion started by: punpun66
4 Replies

9. Shell Programming and Scripting

Request for Shell script to move files from Subfolder to Parent folder and delete sub folder

Hi Team, I am new to shell script and there is a requirement where files should be moved from Subfolder to parent folder. Eg: parent folder --> /Interface/data/test/IN Sub folder -->/Interface/data/test/IN/Invoice20180607233338 Subfolder will be always with timestamp... (6 Replies)
Discussion started by: srivarun15
6 Replies

10. Shell Programming and Scripting

Bash to copy subfolder and files to matching directory

The bash executes but returns no results and the set -xv showed while the $run variable in blue, was extracted correctly, the $match value in green, was not, rather both values in home/cmccabe/Desktop/f1 were extracted not just the matching. There will always be an exact match from the $run to... (7 Replies)
Discussion started by: cmccabe
7 Replies
DCFILE(1)					      DICOM PS3 - Describe DICOM file content						 DCFILE(1)

NAME
dcfile - ACR/NEMA DICOM PS3 ... DICOM PS3 - Describe DICOM file content SYNOPSIS
dcfile [ -b|brief ] [ -filename ] DESCRIPTION
dcfile reads the named dicom or acr-nema input file and describes the encoding method of the file, ie. what transfer syntax is in use, and whether or not a Part 10 style meta-information header is present. OPTIONS
The description goes to standard error. The basic input switches are described in dcintro(1). Options specific to this program are: -b|brief Display a single line brief summary. -filename Show the name of the file supplied in the arguments; a hyphen will be reported if no filename was supplied. ENVIRONMENT
EXAMPLES
% dcfile dicomdir. Meta: UID 1.2.840.10008.1.2.1 Meta: Description "Explicit VR Little Endian" Meta: ByteOrder Little Meta: VR Explicit Meta: Encapsulated No Data: UID 1.2.840.10008.1.2.1 Data: Description "Explicit VR Little Endian" Data: ByteOrder Little Data: VR Explicit Data: Encapsulated No % dcfile expmeta.dc3 Meta: UID 1.2.840.10008.1.2.1 Meta: Description "Explicit VR Little Endian" Meta: ByteOrder Little Meta: VR Explicit Meta: Encapsulated No Data: UID 1.2.840.10008.1.2 Data: Description "Implicit VR Little Endian" Data: ByteOrder Little Data: VR Implicit Data: Encapsulated No % dcfile NM.1 Data: UID 1.2.840.10008.1.2 Data: Description "Implicit VR Little Endian" Data: ByteOrder Little Data: VR Implicit Data: Encapsulated No % dcfile test.spi Data: ByteOrder Big Data: VR Implicit Data: Encapsulated No % dcfile -b evrlewm.dcm DICOM file, with metaheader, Explicit VR Little Endian % dcfile -b evrlenom.dcm DICOM file, no metaheader, Explicit VR Little Endian FILES
SEE ALSO
file(1), dcdump(1), dcintro(1) AUTHOR
Copyright (C) 1993-2010. David A. Clunie DBA PixelMed Publishing. All rights reserved. BUGS
DICOM PS3 6 March 2007 DCFILE(1)
All times are GMT -4. The time now is 05:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy