Programming :: Bash Script: Move Files To Trash Instead Of Deleting?

Jul 10, 2010

I've tried a number of suggestions found on the internet and none of them work. Here's one:Code:mv "$x" ~/.Trash/...where $x is the pathname of the file passed to the script.I've also tried different paths to Trash - on Desktop, in Home folder, in my user folder, it makes no difference. Either nothing happens, or more often, the file is simply copied to my desktop or userfolder with the name "Trash".What is the actual path to the Trash folder and how can I move files there? I'm using Ubuntu 10.04.

View 1 Replies


ADVERTISEMENT

General :: BASH Script To Move Files/folders To Either The .Trash File Or To Another Direcotry?

Dec 2, 2010

I am looking for a script/advice or guidance on how to write a script so that when I use the 'del' command it removes/sends the files/folders to a I specify for example 'dustbin

View 13 Replies View Related

Ubuntu :: Deleting Files / Trash Empty / Disk Still Full

Sep 27, 2010

I've been getting this error message:"The configuration defaults for GNOME Power Manager have not been installed correctly. Please contact your computer administrator."a few times, and it turns out to be because of low disk space. No worry, I empty the trash uninstall unneeded programs and clean out the downloads folder that filled up my disk. And all is ok. But not this time.Since I can't use X, I delete stuff from the terminal, and also make sure to clean out the .Trash in both /home and /root. But still the disk is full. I delete more stuff, but it doesn't even seem to go to .Trash. It disappears, but no more disk space.

View 8 Replies View Related

General :: Dolphin Can't Move Files To Trash?

Jul 12, 2011

I have Ubuntu 10.l0 installed on my laptop. I recently install the KDE desktop from the Software Center. Today, I noticed something strange. I tried to move a file to the trash when I got this error message: "The trash has reached its maximum size! Cleanup the trash manually." I don't have any files in the trash. I went back to Gnome, and was able to delete the file. I opened up Dolphin while still in Gnome, and couldn't delete anything, so I know that this isn't a KDE problem

View 5 Replies View Related

Ubuntu :: Cannot Move Files To Trash / Recycle Bin Does Not Retain Stuff

Jul 23, 2010

When I try to move a file to trash, it doesn't retain anything. I drag a file to the trash bin icon, I open the trash bin, its' empty. How do I make my trash bin retain some trash?

View 1 Replies View Related

Ubuntu :: Can't Move Files In Host To Trash - Prompted To Delete Permanently

Jul 23, 2011

ubuntu 11.04
ubuntu classic
wubi

When I try to delete a file in the host directory (and sub-directories), I see the prompt, 'Cannot move file to trash, do you want to delete immediately?'

I googled this issue and see some solutions that require editing fstab, but not sure if that's the right approach in wubi, and not so sure what edits I would make in fstab anyway.

View 3 Replies View Related

OpenSUSE :: When Move Something To Trash It Doesn't Show The Option Of Empty Trash

Mar 12, 2011

When I move something to Trash it doesn't show the option of "Empty Trash". I can use "move to Trash" and it just moving there like some ordinary folder, but shift+del give me an option for deleting the files. Using OpenSUSE 11.3 32bit.

View 6 Replies View Related

Ubuntu :: Fstab Configuration - Cannot Move To Trash - Only Permanently Delete Files From The Windows Partition

Jan 16, 2011

I edited fstab so that my Windows disk partition will be automatically mounted when I log on. However, when I delete a file from said partition, I am told that the item(s) cannot be moved to trash - I can only permanently delete files from the Windows partition. Here is how I configured in fstab: Code: /dev/sda1 /media/Vista ntfs nls=iso8859-1,umask=000 0 0 I suspect I mis-configured the options. Can anyone see an issue?

View 1 Replies View Related

Programming :: Bash File Names Different Than Openbox Trash

Feb 14, 2011

Im writing my first bash script. Its function is to move files to the trash can and write a log file in the same format that the system does to allow for file restoration. The problem is that in bash, everything works fine, but in the OpenBox window session, the files are named after the source directory, not the original name. Heres the script:

Code:
#!/bin/bash
# trash - Script to move file or folder to the trash can and create a log file
##### Functions #####
err_output () # Writes error message {
echo "$0: cannot stat `$1': No such file or directory"
echo "USAGE: $0 SOURCE DEST"
exit 1 } >&2

write_log_numbered ()
# Writes log entry for numbered files {
echo "[Trash Info]" > $HOME/.local/share/Trash/info/${FILE}.$max.trashinfo
echo "Path="$PWD >> $HOME/.local/share/Trash/info/${FILE}.$max.trashinfo
echo "DeletionDate="`date "+%Y-%m-%dT%H:%M:%S"` >> $HOME/.local/share/Trash/info/${FILE}.$max.trashinfo
}

write_log_unique () # Writes log entry for unique files {
echo "[Trash Info]" > $HOME/.local/share/Trash/info/${FILE}.trashinfo
echo "Path="$PWD >> $HOME/.local/share/Trash/info/${FILE}.trashinfo
echo "DeletionDate="`date "+%Y-%m-%dT%H:%M:%S"` >> $HOME/.local/share/Trash/info/${FILE}.trashinfo
} make_paths () # Makes necessary folders {
mkdir -p ~/.local/share/Trash
mkdir -p ~/.local/share/Trash/files
mkdir -p ~/.local/share/Trash/info
}

##### Main #####
make_paths
SOURCE="$1"
DEST=$(dirname ~/.local/share/Trash/files/filename)
[ -e "$SOURCE" ] || err_output "$SOURCE"
[ -d "$DEST" ] || err_output "$DEST"
FILE="$(basename "$SOURCE")"

if [ -e "${DEST}/${FILE}" ]; then
max=0 DIR="$(pwd)" cd "$DEST"
shopt -s nullglob for backup in "${FILE}."; do
nr=${backup#${FILE}.}
if [[ "$nr" =~ ^[0-9]+$ ]]; then
if (( nr>max )); then
max="$nr" fi
fi
done
cd "$DIR"
max=$(( max + 1 ))
write_log_numbered
mv -- "$SOURCE" "${DEST}/${FILE}.$max"
else
write_log_unique
mv -- "$SOURCE" "$DEST/${FILE}"
fi

So I run the script with the test file "Junk". In bash, it moves over and its named correctly.
Code:
~/.local/share/Trash/files$ ls
file file.1 Files Files.1 Junk
The log file is also named correctly

Code:
~/.local/share/Trash/info$ ls
file.1.trashinfo Files.1.trashinfo Files.trashinfo file.trashinfo Junk.trashinfo

But, when I go to view the trash can in the file manager in Openbox, the file is called "Testing" which is the name of the source directory. However, if I go to the trashcan via its full path (going to .local/, then share/) all the files are named correctly. Whats going on here? Is there some way to get the trash can to read the correct file name?

View 4 Replies View Related

Ubuntu :: BASH Script To Move Files More Than 30 Days Old?

May 12, 2011

I need to move files to a backup drive if they are over 30 days old. All I could find, when looking for scripts, were ways to sort files by date and the solutions were all over the place and nothing seemed simple or good.

I've thought of building my own running "ls -al > filelist.txt" type of approach and then processing the file, but not sure that is best way. An array would be much easier and eliminate the file, but never done an array in bash.

View 9 Replies View Related

Programming :: In A Bash Script - Move A Line To A New File?

Apr 23, 2011

I've got a bash script I'm using to download a text file list of links via axel. What I'd like to do is automate the movement of completed links in the for loop when axel has successfully completed the download. This is what I've got. I can figure that I can just echo append the line to a new file, but what is the easiest way to delete the line with the link I just downloaded?

Code:

#!/bin/bash
for i in $( cat $1); do
axel --alternate --num-connections=6 $i
export RC=$?

[code]....

View 14 Replies View Related

Ubuntu :: Trash Not Deleting So Unable To Use Flash Drive

May 30, 2010

My trash won't delete and it is causing me to not be able to use my flashdrive. When I tell my trash to empty it will either say it will but the files will still be there or it will say a can't b/c i didn't delete it from my trash(screenshot). I don't know what to do to get it to get rid of the files since I tried telling it to bypass the trash and that didn't do anything.

View 9 Replies View Related

Ubuntu :: Write A Bash Script Which Will Find Files Then Move Them To A Specific Directory?

Sep 1, 2011

I'm trying to write a bash script which will find files then move them to a specific directory.

So far I have:

Code:
#!/bin/bash
#script to find and move files
src_dir="/path/to/source/directory"
des_dir_mov="/path/to/destination/directory/for/movies"
des_dir_img="/path/to/destination/directory/for/images"
find $src_dir -iname '*.avi' -type f -exec mv '{}' $des_dir_mov ';'

I'd like to have all the possible movie file types then the image file types checked in a loop.

Every time I try to include an array in this script it breaks

View 3 Replies View Related

Fedora :: Cannot Move File To Trash

Mar 6, 2010

I'm trying to move certain files to Trash using File Browser. I continually get this message:"Cannot move file to trash, do you want to delete immediately?"I am logged in under my user name; I (my user name) am the owner of these files; ALL permissions are on (rwx for owner, group, and other); and Trash is empty. Still I get this message.

View 4 Replies View Related

Ubuntu :: How To Move Trash Bin/can To Desktop

Jan 21, 2010

I would like to know how I can move the trash bin / trash can to the desk top & not have it in the status bar. Is there away to do this ?

View 3 Replies View Related

Ubuntu :: Can't Move Items To Trash

Dec 4, 2010

i recently install NTFS-Config and Auto-mount my NTFS_partitions... They are now successfully mounting in Start-up, but whenever i try to remove something(within) NTFS partition, the removing item is not going to Trash,its just deleting that item permanently,

My fstab :-

Code:
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>

[Code]....

View 5 Replies View Related

Ubuntu :: Can't Move Folder To Trash NTFS?

Jun 20, 2010

I have an NTFS partition automatically mounted in fstab. I have read many forums and have done what they have to try and fix this problem, but it still won't move the files to the NTFS trash folder. What can I do to make this work?Here is my fstab entry:

Code:
# NTFS partition /dev/sda1
UUID=5D924B8408514F71 /media/MediaDrive ntfs rw,auto,users,nosuid,uid=1000,fmask=137,dmask=027,utf8 0 0

View 5 Replies View Related

Ubuntu :: Right Click Delete Or Move To Trash Not Available?

Nov 24, 2010

I have a few folders I need to remove and when I right click delete or move to trash not available. I guess I don't have permission. I am the sole user of this machine and the Admin. How do I remove these folders. The folders were part of ClamAV which has been removed. They show up as a virus in my Avast Anti Virus.

View 3 Replies View Related

Ubuntu :: Cannot Move File To Trash / Solution For This?

May 13, 2011

This started happening last week. Whenever I try to delete a file that is not in my /home directory I get the message:

Cannot move file to trash, do you want to delete immediately.

I have found a couple threads in the forums about this issue, but it has always been associated with windows or samba shares.

This is happening on my computer, not on a shared folder or through samba. Its a little frustrating to say the least.

View 2 Replies View Related

Ubuntu :: Files In Trash But Not In Trash?

Dec 24, 2010

I have a problem with a couple of folders in the Trash. If I click on the Trash icon, 2 foldersare there, and when I try to delete them, it just says "Failed to delete the item from the trash"

But when I go to .local/share/Trash there are no files there! Anyway, I tried using the command "sudo rm -rf .local/share/Trash", it shows no error, but the files continue when I click in the trash icon.

View 9 Replies View Related

Programming :: Deleted Files In Directory With So Many Files Without Deleting Directory Itself

Nov 14, 2010

There are millions of files in many directories. Wherenver i try rm * or find or use xargs, they say 'argument list too long' and exit. How can i deleted files in a directory with so many files without deleting the directory itself.

View 3 Replies View Related

General :: Bash - Move Around Files Using "ls -al" Result?

May 26, 2011

How can I write a script to copy files from one directory to another directory according to last modified date?

ls -al
-rw-r--r-- 1 user user 100 2011-05-26 12:33 ABC1234_frontcover_10344000_2011-05.doc

What exactly I want to do is, Using the above bold part of ls -al result the ABC1234_frontcover_10344000_2011-05.doc file should be copied to /home/abcd/ABC1234/2011-05/26/. There should be some way to do it using value of date -r $file +%m and basename *.doc | awk -F_ '{print $1}'.

View 1 Replies View Related

Debian Configuration :: File Don't Move To Samba Trash Directory

Aug 26, 2015

I work in a compagny and i encounter a problem with the samba trash.When i delete a file from our network directory, the file don't move to the samba trash directory. But, the server create the same samba tree like the orginal file. It's more simple with a example.This is the file i delete to my samba tree S:departementgestion_informatiqueinformatiquecommut est.txt.This is the samba tree that the server create at the moment when i delete my file : @IPcorbeilledepartementgestion_informatiqueinformatiquecommun

The problem is here : We want the file test.txt into this trash tree and it isn't.This is the Samba trash configuration :

# Samba Trash
#--------------------------------------------
# http://samba.org/samba/docs/man/Samba3-HOWTO/VFS.html

[code]....

The samba trash work for an another site of our company.

View 0 Replies View Related

Debian Multimedia :: Thunar 1.6.9 Can't Find Move To Trash Shortcut?

May 30, 2015

how to enable the "move to trash" shortcut from the right click in Thunar? Is suddenly disappeared after some upgrading but I didn't remember exactly when.

Unfortunately this is a such cyclic problem...

View 1 Replies View Related

Programming :: Check Folder For Specific Files Than Move Script?

Nov 16, 2010

I have a script that checks a folder for zip files than moves them to a different folder. I want to check every 5 maybe 10 seconds and since cron is setup to run at least a 1 minute increment I'm not sure how to do that time check as probably a loop within the script. One other thing is once the time check is in the script how would a cron job be setup to run this script? Once the script is running cron doesn't need to run it again, is there a feature to check if it's running and if it's not then run it?

find /export/xxxshare -name "*.zip" -exec mv {} /export/store ;

View 3 Replies View Related

Programming :: Bash Programming - Rename Files In A Loop?

Mar 31, 2011

I need to rename the resulted searched files from a loopI have the following code:

find . -name DOC* | while read i
do
find $i -type f -name '*.txt'
done

basically, I am searching for all txt files inside any folder starting with DOC name.this code is working fine with me.I need to rename those .txt files to .txtOLDOS: Ubuntu 10.4Bash shell

View 10 Replies View Related

Ubuntu :: User (vs. Root) Cannot Move To Trash, Only Delete, On Ext3 Partition?

Jan 9, 2010

I just wanted to post this in case it helps anyone else. I have all my personal files (photos, documents, etc.) saved on a separate ext3 partition (so I don't have to worry about them on new installs, etc.). When I tried to delete files, however, I always received the message: "Cannot move file to trash, do you want to delete immediately?".

After much searching and failed fix attempts (mostly unnecessary messing with fstab), I found this post, which is now archived (or I would have replied there):ttp://ubuntuforums.org/showthread.php?t=759544. And frediE's solution, with a couple tiny modifications, finally solved the problem! (So huge thanks to frediE! ). irst, I found my user id, which is 1000, by going to the System > Administration > Users and Groups menu, selecting my user name (e.g. jnewm), clicking "Properties", andselecting "Advanced".

Second, I created a folder on the root of my partition called ".Trash-1000". (I may have needed to use "gksu nautilus" from a terminal to create the folder, I don't recall.)Third and last, I navigated to the root of the partition in my terminal and ran: sudo chown -R jnewm:jnewm .Trash-1000. Followed by: sudo chmod -R jnewm .Trash-1000 (I doubt this second step was necessary, but I'm listing it just in case). (confirmed unnecessary)

View 4 Replies View Related

Fedora :: Make Rules To Move Each E-mail To The Inbox But Still All Incoming Messages Go Straight To Trash?

Apr 1, 2010

Recently did a fresh install of F12, previously used F11 without any problems. Now Evolution move ALL received messages to trash automatically. I have had to make rules to move each e-mail to the inbox but still all incoming messages go straight to Trash.

View 3 Replies View Related

Programming :: List Files In Bash + Add Url Before Them?

Dec 8, 2010

I am an uploader to a various hosts, so this tiny script me a lot. I make a rar archive and split files with 100mb. I could get 3-4 or even 76 parts of rar files and it would take me some time to paste all these urls to remote upload function of filehosting sites. For example:

Code:

server:/home/cober/downloads/teevee# ls -al
total 358784
drwxrwxrwx 2 root root 4096 Dec 8 19:38 .

[code]....

View 1 Replies View Related

Programming :: Bash Script To Copy Files?

Jul 13, 2011

I have a lot of filenames (strings) following the same convention

m02_+1+7_London_0000$01.cfg
m02_+1+8_London_0000$01.cfg
m02_+1+8_London_0000$01.cfg

[code].....

What I want to do is to create a script that will interpret the following string and save into variables part of its name

m02_+1+7_London_0000$01.cfg as
------X-Y--City---------
X=1
Y=7
City=London

[code]....

then I want to copy the files that go all the files with the same City and X and Y to the same subfolder City/MX.Y I will need some help start doing that. And I think the first would be to get part of the filenames strings into variables.

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved