I am working on an project which is based on system security.I want to move all data from a flash drive into my system hidden folder.But I don't know how can i do this in a single terminal command(bash). Is there any way to do this in Ubuntu?

For example: There are 50 folders in a USB flash drive.Now I want to copy all folder in system and then format the pendrive or simply move data form a pendrive.So how can i do this? I hope you guys understand my question.

Thanks in advance

cd /media/flashdriveid/

where flashdriveid is your mountpoint

mkdir /home/$USER/.hiddendirectory
cp -R * /home/$USER/.hiddendirectory

and the whole flashdrive will be copied (cp -R is recursive so including subdirectories) to a new directory called ".hiddendirectory" and it is hidden from normal view due to the "." in front of it. If you have an existing hidden dir skip the "mkdir" command and change the "cp" command to the location you want to use.

If you want to move the files from the flashdrive you can exchange "cp" for "mv".

  • how can i format flashdrive?because i want to secretly copy whole content and then format flashdrive – Nitin Khanna Feb 12 '18 at 14:34
  • 3
    that is a new question and also duplicate – pLumo Feb 12 '18 at 14:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.