The issue with using cpio is that it preserves the directory hierarchy. You could go with:
but that would generate a process for every file, and cp is not most efficient way to copy files.
Are you trying to just flatten the directory hierarchy? If so, perhaps something like:
which would create hardlinks to all the files in the target directory. Use the -s option of ln if the target directory is in a different filesystem.
If you need to make a copy of the files:
Be advised that nothing is being done for filename collisions.
You also specified find /path/to/folder .*.txt. The -name option is missing, and use single-quotes. Otherwise the shell globbing expansion may give you a surprise.
This User Gave Thanks to derekludwig For This Post:
I have many types of files (Eg: *.log, *.rpt, *.txt, *.dat) in a directory. I want to display all file types except *.txt.
What is the command to display all files except "*.txt" (9 Replies)
Hello All. I am trying to do this from a terminal prompt on my mac....
I have 100 folders all named different things. Those 100 folders are inside ~/Desktop/Pictures directory.
Each of the 100 folders are uniquely named. The image files inside of each folder only have some similarities.
... (1 Reply)
HI All,
I am coding a shell script which will pick all the .csv files in a particular directoryand write it in to a .txt file, this .txt file i will use as a source in datastage for processing.
now after the processing is done I have to move and archive all the files in the .txt file to a... (5 Replies)
I have a requirement to delete the files and folders under a given directory.
my directory structure is like this..
Data
|
A(Directory)
|_PDF(Directory)----pdf files
|_XML()Directory --xml files
|--files
|
B(Directory)
|_PDF(Directory)----pdf files
|_XML()Directory --xml files ... (1 Reply)
How to copy files from one directory to another directory with the subfolders copied.
If i have folder1/sub1/sub2/* it needs to copy files to folder2/sub1/sub2/*.
I do not want to create sub folders in folder2.
Can copy command create them automatically?
I tried cp -a and cp -R but did... (4 Replies)
wget -x -i link.txt
The above downloads and create unique entries for the 97 links in the text file. However, each new file is saved as CM080 with a FILE extention. Is there a way to convert each file in that directory to a .txt? The 97 files are in... (12 Replies)
hi,
i have a requirement to delete all the files from all the directories except some specific directories like archive and log.
for example:
there are following directories such as
A B C D Archive E Log F
which contains some sub directories and files. The requirement is to delete all the... (7 Replies)
Due to budget constraints I have to reinvent an Enterprise backup system in a SPARC (sun4v) Solaris estate (10 & 11). (yep - reinvent wheel, fun but time consuming. Is this wise?! :confused: )
For each filesystem of interest, to try to capture a 'catalog' at the front of each cpio archive (for... (1 Reply)
Hello, this is my first thread here :)
So i have a text file that contains words in each line like
abcd
efgh
ijkl
mnop
and i have 4 txt files, i want to add each line to each file, like file 1 gets abcd at the end; file 2 gets efgh at the end ....
I tried with:
cat test | while read -r... (6 Replies)
Discussion started by: azaiiez
6 Replies
LEARN ABOUT SUSE
cpio
CPIO(1L)CPIO(1L)NAME
cpio - copy files to and from archives
SYNOPSIS
cpio {-o|--create} [-0acvABLV] [-C bytes] [-H format] [-M message] [-O [[user@]host:]archive] [-F [[user@]host:]archive]
[--file=[[user@]host:]archive] [--format=format] [--message=message] [--null] [--reset-access-time] [--verbose] [--dot] [--append]
[--block-size=blocks] [--dereference] [--io-size=bytes] [--quiet] [--force-local] [--rsh-command=command] [--help] [--version] < name-list
[> archive]
cpio {-i|--extract} [-bcdfmnrtsuvBSV] [-C bytes] [-E file] [-H format] [-M message] [-R [user][:.][group]] [-I [[user@]host:]archive] [-F
[[user@]host:]archive] [--file=[[user@]host:]archive] [--make-directories] [--nonmatching] [--preserve-modification-time] [--numeric-uid-
gid] [--rename] [-t|--list] [--swap-bytes] [--swap] [--dot] [--unconditional] [--verbose] [--block-size=blocks] [--swap-halfwords] [--io-
size=bytes] [--pattern-file=file] [--format=format] [--owner=[user][:.][group]] [--no-preserve-owner] [--message=message] [--force-local]
[--no-absolute-filenames] [--sparse] [--only-verify-crc] [--to-stdout] [--quiet] [--rsh-command=command] [--help] [--version] [pattern...]
[< archive]
cpio {-p|--pass-through} [-0adlmuvLV] [-R [user][:.][group]] [--null] [--reset-access-time] [--make-directories] [--link] [--quiet] [--pre-
serve-modification-time] [--unconditional] [--verbose] [--dot] [--dereference] [--owner=[user][:.][group]] [--no-preserve-owner] [--sparse]
[--help] [--version] destination-directory < name-list
DESCRIPTION
GNU cpio is fully documented in the texinfo documentation. To access the help from your command line, type
info cpio
The online copy of the documentation is available at the following address:
http://www.gnu.org/software/cpio/manual
CPIO(1L)