Quantcast
Channel: Copy the same file to the desktops of all users - Unix & Linux Stack Exchange
Browsing index pages (3 articles)

Copy the same file to the desktops of all users

I’m looking for a way to copy a file to all Desktops directory of each user. Something like: cp myfile /home/*/Desktop/ I found a way to copy files to all home directories using xargs but it fails on...

View Article


Answer by msp9011 for Copy the same file to the desktops of all users

Your code expands as: cp myfile /home/user1/Desktop/ /home/user2/Desktop/ /home/user3/Desktop/ /home/user4/Desktop/ ... /home/userN/Desktop/ From man of cp: Copy SOURCE to DEST, or multiple SOURCE(s)...

View Article


Answer by Kusalananda for Copy the same file to the desktops of all users

Since cp only ever takes a single destination name, you would have to make it a loop and call copy the files individually: for destdir in /home/*/Desktop/; do cp myfile "$destdir" done Using xargs...

View Article
Browsing index pages (3 articles)


Latest Images