I have multiple files in a Linux systems where I want to copy them with a single cp command into a different path and directory. Should I write a bash script to copy one by one?
Recommended Answers
Jump to Post— Dani 5,664What about a script that assembles all the file names and concatenates then together before executing the single cp command.
Jump to Post— AndrisP 193Do not need write script for this. Actually its a single line command e.g.
You have directorydir1which contains multiple files anddir2which is target to copycp dir1/* dir2/copy all files
All 6 Replies
rproffitt 3,249 https://5calls.org Team Colleague
samueltarcin999 0 Newbie Poster
Reverend Jim 6,665 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
Dani 5,664 The Queen of DaniWeb Administrator Featured Poster
rproffitt commented: That sounds like tar with extra steps (nod to Rick and Morty memes.) +15
Shyal_Beardsley 0 Newbie Poster
AndrisP 193 Posting Pro in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.