Timeline for copying files from multiple specefic parent directories
Current License: CC BY-SA 4.0
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 6, 2022 at 1:10 | comment | added | muru |
@LocalHosT if you get that, then you can use xargs to work around that: printf "%s\0" **/True/*.txt | xargs -0 cp --backup=numbered -t dst/report/1/ (assuming GNU xargs and cp)
|
|
| Jun 5, 2022 at 20:08 | comment | added | amkyp |
Hmmm, seems to be not working, getting error bash: /usr/bin/cp: Argument list too long.
|
|
| Jun 5, 2022 at 15:43 | comment | added | amkyp |
Hmmm, thanks @muru . Also I made that to work like this find . -type f -not -name "*.txt" | rename -E 's/.txt.~([0-9]+)~/___$1.txt/g'.
|
|
| Jun 5, 2022 at 15:11 | comment | added | muru |
If you have the Perl rename available in your OS, you can try that: prename 's/(.txt).~(\d+)~$/-$2$1/' dst/report/*/*, but then you still risk some files getting overwritten (e.g., if you had x.txt, x-1.txt, x.txt.~1~).
|
|
| Jun 5, 2022 at 14:21 | comment | added | amkyp |
Thanks, Is there any way to change bar.txt.~1~ to bar-1.txt and so on for other files. Thinking of find . -type f -exec sed -i 's/.txt.~number~/-number.txt/g' {} + but not sure how to keep the number for later use in sed.
|
|
| Jun 5, 2022 at 10:52 | history | answered | muru | CC BY-SA 4.0 |