[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-cpio] CPIO can also delete the files from destination location.

From: nihar.panigrahy
Subject: [Bug-cpio] CPIO can also delete the files from destination location.
Date: Mon, 7 Feb 2011 14:50:24 +0000

Hi Friends,


I want to draw yours kind attention to a bug which surfaced during my day-to-day project activity. We all know CPIO command is the best way to Copying files to an archive, Extracting files from an archive, and passing files to another directory tree. We encountered a serious problem while performing one of these three primary functions of CPIO i.e. copying files to an achieve.


find -name *.sh  | cpio -pvdmu /ABC/XYZ

find -name *.ksh | cpio -pvdmu /ABC/XYZ


The actual intention behind the above commands are to find all “.SH and .KSH” files from the existing location and copy those files by creating the same directory structure at the given location. The parameters can explained like;

-p:  Run in copy-pass mode. cpio copies files from one directory tree to another, combining the copy-out and copy-in steps without actually using an archive.

-v: List the files processed.

-d: Create leading directories where needed.

-m: Retain previous file modification times when creating files.

-u: Replace all files, without asking whether to replace existing newer files with older files.


What we found is; if the source folder and destination folder (e.g. XYZ, as shown in the command above) are the same then it deletes all the content of the source directory, which as per requirement shouldn’t happen, because it may so happen that the user want to accumulate all the required files into one location or some other project need.


The fix sought for this bug can be a warning message saying “The source and destination location are same, so can’t complete the activity”.


Thanks and regards,

Nihar Ranjan Panigrahy


reply via email to

[Prev in Thread] Current Thread [Next in Thread]