Ubuntu :: Script For Each File In Folder?
Mar 15, 2011I want to do a specific task for each file in a specific directory. First I want to see if I can list them with:
Code:
#!/bin/bash
for filename in `pwd`
[code]...
I want to do a specific task for each file in a specific directory. First I want to see if I can list them with:
Code:
#!/bin/bash
for filename in `pwd`
[code]...
When I position icons on the desktop in specific places, then I choose to move a file or folder into another folder, all the icons arrange back to the left side. This happened in an earlier version of KDE 4.x, disappeared the next version, and reappeared. how to keep this from happening. It makes using the desktop a pain in the you know what.
View 2 Replies View RelatedAfter upgrading to 11.04, I noticed something strange, being that when I want to drag a file or folder from one Nautilus folder window to another which is not visible, I can no longer hold the item over said folder's taskbar button and wait for it to appear. It just shows the + for copy, and when I let go (which I have no choice but to eventually do), it creates a launcher to that item (I assume it's doing that, and not actually copying there, but the + has me unsure).
I've looked in Nautilus's preferences to see if this is some new behaviour that I can revert back to, but could find nothing there.
I'm of course using the Classic desktop with bottom panel being the taskbar. If you know how I can rectify this, please let me know, as the times I would want to create a file or folder launcher without the usual hassle would be rare, but I am constantly dragging stuff from one folder to another, and it would be a real pain to have to line up source and destination folders each time.
this is posable but am trying to do this "Create folder from a filename and move the file into the folder" i have 500000+ file's i need to do with is there a easy way?I really don't want to download them all make/move them with filemonkey just to re-upload them
View 2 Replies View Relatedi am trying to install a driver for my belkin wireless usb adapter but when i type make it says cannot find lib/modules/<debian version>/build so it does not configure the sources.
View 1 Replies View RelatedWhen i want copy a file or folder in some system folder like sbin,Etc.show me error about privilage but when I'm in console i use su command for become admin and i can copy my file or folder.in other operation system like windows user can copy anything,i want know for direct copy my folder in linux without console what should i do? i must join my user name in root group?
View 4 Replies View RelatedI been using linux for a while, but I havent had the time to really learn it. Something Id like to get more familiar with is bash so here is a simple example of something I would like to do:
I have a directory full of files. For each file in the directory create a new subdirectory with each files name.
I tried this:
#im already in this directory
aaa=./*
for a in $aaa
do mkdir $a
done
One of the problems is that there are spaces () and - in the filenames so I get many subfolders with names like "-" which i don't want.
I tried stuff like:
aaa=./*
for a in $aaa
do mkdir "'"$a"'"
done
This of course also did not work.
Additional I tried just creating a folder with the name of one of the files and I got this:
mkdir: cannot create directory `(audio) - R56339.EXE': File exists
Well yeah a file exsists with that name, but I want to create a folder- why is there a conflict?
Just to be clear here are the contents of this folder:
~/Desktop/LAB/Media/Drivers - (Image Deployment)/Optiplex_GX260/XP> ls
(audio) - R56339.EXE (NIC-Onboard-Intel) - R54402.EXE
(Modem-datafax-V92) - R54403.EXE OEM_Applications
[Code].....
I have recently switched to using LXDE on my PC and I am on the whole pretty pleased with it. However,PCMan is giving me a really odd problem. Some of the files/folders are being displayed in the wrong order where they contain numbers. They are being ordered by their first digit not the whole number.
[Code]...
How can I check and set who can view or open a given folder or file?
View 1 Replies View RelatedInitially I thought - use a for loop with ls in it:
Code:
However this causes lots of problems (folders have extensions, I have duplicate folders, the names with spaces create a folder for each element of the name).
The contents of the folder is basically movies (some with subtitles). Some of the names have things like (original) or CD1 CD2 in them.
I have a folder that I don't know why becomes a file and now I can't open it. Can I do somthing to convert again into a folder. I thinking about commands like chmod somthing like that.
View 5 Replies View RelatedIs their a way, or a script/command that can move files into their own folder, naming the folder the same name as the file?
View 1 Replies View RelatedI have a dell precision m4300 laptop with a 360 wireless bluetooth dell adapter On my system there is a debian lenny with kde3 and backported enable(everythings is p to date except bluez-utils and bluetooth holded at version 3.36-3)
Nowadays bluetooth more less works fine, I can send and receive single file to/from my phone (nokia n70)
The hell begin when I try to browse my phone files from konqueror...with bluetooth:/ I can see the list of all the device near me with sdp://[address]/ i can see two icons (obex file transfer & obex object push)
but I cant see or access to any file or folder into the phone.
I also try to update my bluez-utils to 4.60-1~bpo50+1 but in this case kbluetooth totally fail and a see the contextual menu of the system tray icon all disaled.
This is probably a very simple question and answer, so here goes... Doing the basic:
Code:
rm -fv -R "FILE1" "FILE2" "FILE3" "FILE4" "FOLDER" "FILE_WHATEVER"
...works just fine, but I would like to know if there is a way to only remove if the files are actually there. Currently, I know of this format, which works just fine:
[Code]...
...however, it seems to only work one file/folder at a time. Is there a way to modify it: I tried this, but it didn't seem to work:
[Code]...
I can't search file in another folder other than the home folder. Like when I try to search in my mounted NTFS drive, it only shows and only searches my home folder, not the current open folder in mounted drive. I also have installed "Beagle Search" to index my data and reduce time searching,
View 2 Replies View Relatedwhere is the folder with the temporary file kept?
View 1 Replies View RelatedI opened up my Gimp brushes folder so that I can put a brushes file into the folder. Would not let me do it. Said I am not the owner and do not have permission. I right clicked inside the folder, same thing permissions grayed out, not owner. No apparent option to log in or do anything to gain permission. What can I do?
View 1 Replies View RelatedI know this is a relatively simple problem but no matter what combination I try for my alias, I don't seem to be able to get it right! All I want to do is scp a file from my current folder to a location on the network:
Code:
scp filename username@computername:/folder1/folder2
This is the usual layout of the command that I use, so I thought that to save time, I would create an alias or even a function which did this for me, so all I had to type was
Code:
scp101 filename
and it would copy it to the set folder on the remote computer...
My attempt at an alias looks like:
Code:
alias scp101='scp !* username@computername:/folder1/folder2'
and I have also attempted a function:
Code:
scp101()
{
scp "$1" username@computername:/folder1/folder2
}
The alias tells me that filename is not a directory, which I assume means that I have some of the syntax wrong in the alias but I did a google search and I can't seem to find a decent example of what I'm trying to do. When I load up a terminal, I get an error message about the "(" of the scp101 function - so I've obviously can't get the syntax of that right either...
I'm having trouble finding the correct modifiers to the stat command to print out the file/folder properties in human readable format. I would like to run a command on a given file or folder and have the file size in kb, mb, or gb size as opposed to byte size in addition to other pertinent information.
View 2 Replies View RelatedWhat's the easiest way to make a given file/folder (or multiple files) require a password upon opening moving copying etc, without encrypting the file/archive. The password should at least be manually defined upon establishing it, and preferably it could be modified.
I'm aware of the community belief that this is redundant. I don't want to know how to start from scratch a different way, or why I should or shouldn't do this or that. Just how to password lock a file/folder regardless of your feelings on the matter lol.
I need to create a folder for every single file in a directory, possibly making the folder have the same name as the file that it will be containing. Is it possible to do via terminal?
View 9 Replies View RelatedQuestion for people good with Bash scripts.
In a script, how do you name a file after a folder?
For example code...
I have been looking around online and I am seeing that there are several solutions for doing a nightly automated backup on Linux. I was wondering what people here actually use for doing such and why they use one particular backup method over another.
What I am looking to do is every night (at say 3am) I want my system to backup my 200gig Documents folder to my external hard drive. Does Ubuntu have a tool built in by default to do this or do I need to add something from the repos/online?
I am running ubuntu using VirtualBox on a Macbook Pro. I wanted to share my documents folder on the Mac in the virtual machine. I had no issues creating/mounting the share folder on ubuntu. However the file permissions for the shared folder are owned by root.
Code:
drwx------ 1 root root 1088 2010-02-04 10:18 Mac_Share/
I used the following command to mount the folder:
Code:
sudo mount -t vboxsf Share_Documents ~/Mac_Share/
I checked that the folder is mounted I can see what is there using
Code:
sudo ls Mac_Share/
How do I make the folder accessible to the user? Is there another -option needed to do this in the mount command?
How to list the contents of a folder to a text file. I'm trying to list all my music, including all subfolders, etc. to a text file, but I can't remember the command.
View 3 Replies View RelatedI accidentally deleted a php file under my public_html folder. Is there a way I can get it back?
I typed: sudo rm contacts.php
I have two drives in my computer: a 160GB and an 80GB. The 80 holds Ubuntu, the home folder, etc. The 160 is for other files. I need to change the read-write permissions on the 160, but I can't. If I do it through the GUI (right-click>permissions) it just changes back instantly. If I do it through the command line (even with sudo), it has no effect.
View 5 Replies View RelatedI need to copy a file from my desktop to a system folder but unsure how. It needs to go to the "etc/X11" folder
View 6 Replies View RelatedI want nautilus to use file preview or not depending on what the view is for that folder. I want file preview to be enabled if I am using icon view, and disabled if I am using list view. This way image folders will be previewed (because I have set such folders to icon view), and other folders wont be (because they default to list view). I also want the desktop to be always previewed.This seems like quite a simple and common-sense desire, but I cant find out anywhere how to do this. At the very least what I'd like is the ability for force preview for a folder if I want to investigate it more closely - even if I have to click a button of select something to do so.
View 1 Replies View RelatedWill it be possible in Unity to have file and folder icons on the desktop?
View 9 Replies View Related