Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 06-12-2020, 12:53 PM   #1
LQ Newbie
Registered: Nov 2017
Posts: 7

Rep: Reputation: Disabled
Enforce copying instead of moving to preserve the files in original locations

Is it possible to set constraints on folder to not move files to it (only copy)?
I want to create a temporary RAM disk and protect files from other locations against moving them to RAM disk. Similar behaviour is applied when moving files between drives - files are copied. When moving inside the same drive, files are moved from source folder to other one. I want to allow only copying files to RAM disk.
Old 06-12-2020, 06:42 PM   #2
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 18,976

Rep: Reputation: 3281Reputation: 3281Reputation: 3281Reputation: 3281Reputation: 3281Reputation: 3281Reputation: 3281Reputation: 3281Reputation: 3281Reputation: 3281Reputation: 3281
Seems you are in the habit of using a GUI file manager to handle your files. In which case that behaviour may be customisable - or not, will depend on the file manager. Personally I'd use rsync or cp - when you're in control, you are in control.

I note you appear to have no intention to copy updated files back to the original location - do you not care ?. These days there is little advantage in using RAMdisk rather than tmpfs.
Old 06-13-2020, 01:17 PM   #3
LQ Newbie
Registered: Nov 2017
Posts: 7

Original Poster
Rep: Reputation: Disabled
Hi syg00,
Thank you for your response and apologize for not being specific enough.

Yes, mostly I use Nemo to handle the files. Do you know how to set described behaviour in Nemo on Cinnamon? Do you think it may be set somewhere in GUI settings or it might be necessary to edit configuration files (which ones)? Frankly speaking, I didn't see that option. Where should I look for it?

Saying RAM disk I mean virtual file storage located in RAM memory, not ramfs specifically. I use tmpfs as I can set the size limit to avoid potential errors ('disk full' error is better than crash when all memory is used).

I do not plan to copy files back to their source locations. I want to use RAM disk (tmpfs) as temporary 'Upload' folder for browser run from different user profile. I described what I want to achieve in dedicated topic: Run program with GUI and sound as a different user. This thread has been created separately as it might be useful for others.

Last edited by Zbigniew; 06-13-2020 at 01:19 PM.
Old 06-13-2020, 03:29 PM   #4
Registered: Aug 2002
Posts: 20,217

Rep: Reputation: 3458Reputation: 3458Reputation: 3458Reputation: 3458Reputation: 3458Reputation: 3458Reputation: 3458Reputation: 3458Reputation: 3458Reputation: 3458Reputation: 3458
You can disable the move action ( i.e. right click menu) at /usr/share/nemo/actions/. You should be able to create a new action to copy files to just your tmpfs filesystem. Same thing can be done for copying if you only want to allow copying files to RAM.

I don't if this works or even still possible but you might be able to disable nemo shortcuts key for moving/copying by creating a user configuration file.

If you need to limit terminal commands you can create an alias or your own functions.
Old 06-14-2020, 12:51 PM   #5
LQ Newbie
Registered: Nov 2017
Posts: 7

Original Poster
Rep: Reputation: Disabled
Hi michaelk,
Thank you for advice. I found that RAM disk (tmpfs) is treat like other drive and files are copied to it (that is what I want), anyway I tried to set a rule for educational purposes. ;-)

I created a file copying-instead-of-moving.nemo_action in /usr/share/nemo/actions with the same permissions as other files there have. Inside the file I wrote:
Name=Copy instead of move
Comment=Prevent moving files into test folder
Exec=cp %P/* /home/testuser/Documents/test/
Unfortunately, it does not work. When I dragged and dropped files to test folder, files were moved, not copied. I tried also with the followings
Exec=cp %P/* /home/testuser/Documents/test/*
Exec=cp * /home/testuser/Documents/test/
Exec=cp * /home/testuser/Documents/test/*
Exec=<cp %P/* /home/testuser/Documents/test/>
Exec=<cp %P/* /home/testuser/Documents/test/*>
Exec=<cp * /home/testuser/Documents/test/>
Exec=<cp * /home/testuser/Documents/test/*>
also with no success. After each modification I restarted Cinnamon (Ctrl+Alt+ESC), just in case.

Parameters for Nemo actions I found on sample.nemo_action.

Any ideas what I am doing wrong?

Last edited by Zbigniew; 06-15-2020 at 12:33 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Can't preserve directory structure when copying files andrew.comly Linux - Server 10 12-14-2015 08:01 PM
How to preserve all timestamps while copying files megalosaurus Red Hat 12 07-13-2015 05:19 AM
Copying a set of files through CIFS from Linux to Windows 7 to preserve the timestamp Rupadhya Linux - Software 2 08-28-2013 08:33 PM
Help - My Samba share changes the timestamp when copying files to it.. Preserve Time. hheejj Linux - Software 2 06-28-2005 09:34 AM
preserve user/group when copying files km4hr Linux - Software 1 01-11-2005 05:21 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:25 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration