General :: Listing Filenames Without The Directories?
Oct 3, 2010
list filenames one-per-line, in BASH without including directories. I think he was either wrong or making that up. There is a way to list just the names and one per line but there aren't any arguments I can find that can be used to exclude directories.
Code:
IFS=', '; files=`ls -m`; for i in $files; do if [ -f $i ]; then echo $i; fi; done That does only use ls as a command, however he said his GSI thought he could do it without all that...
Quote:
ricky@ricky-desktop:~$ ls -l
total 1376
drwxr-xr-x 2 ricky ricky 4096 2010-10-02 22:17 Azureus Downloads
drwxr-xr-x 4 ricky ricky 4096 2010-10-02 22:16 Desktop
[code]....
View 6 Replies
ADVERTISEMENT
Jul 22, 2011
suppose in my current directory, I have 50 sub-directories. Now, I am interested only in about 20 of those sub-directories (whose names match a pattern). I would like to recursively list the contents of these 20 sub-directories. How do I do that ? I would like to do this in Solaris 10 and Linux(RHEL 5.x).
View 3 Replies
View Related
Oct 31, 2010
Is the command "ls -d" meant for only listing directories? Because i tried it and it ALWAYS display just a blue dot. If not what is the correct way to show only directories? I.e. MSDOS equivalent "dir /ad".
View 2 Replies
View Related
Apr 20, 2011
Im having proftpd 1.3.3a standalone on squeeze with mysql backend. It all works fine with one little problem. When i log in to directory, there is nothing in it - knowing there is shed load of files. Directories are simply not being listed. Im logging in as group member and directory permissions are rwxr-xr-x. In addition to that when i try to create new directory connection is being lost and client attempts to reconnect. After successful reconnection, connection gets lost and over and over again until i abort.
[code]...
i find Failed binding to 0.0.0.0, port 201: Address already in use. Check the ServerType directive to ensure you are configured correctly.
View 1 Replies
View Related
Dec 1, 2009
I got a filename called like this:
beach---------20090808-110000.ogg
beach---------20090808-120000.ogg
It's like this:
name----------YYYYMMDD-hhmmss.ogg
Now Im splitting these hourly files into 1 minute files. I get then this output sofar properly:
beach---------20090808-110000_00.mp3
beach---------20090808-110000_01.mp3
beach---------20090808-110000_02.mp3
and so on....
the 00, 01, 02 and up are the minutes it has splitted it. Now I need a script, after it did this, to rename the file names into this:
beach---------20090808-110000.mp3
beach---------20090808-110100.mp3
beach---------20090808-110200.mp3
beach---------20090808-110300.mp3
View 4 Replies
View Related
Dec 19, 2009
i am in need of linux help. iam at college and i need this back/restore script to pass this final part of an assessment. i require a backup script that will not only backup but also restore files to the relevent directories. e.g. users are instructed to store all wordprocessor files in a directory named wp. so i am needing to create a backup directory and 3 directories within that and some files within the 3 directories and then back them up ot restore them. l know i should/have to do this myself by been trying to get/understand info for the last few days and came up with zero.
View 14 Replies
View Related
May 15, 2011
I want to make a webserver with multiple users allowed to login through SFTP to a specific folder, www.Multiple users are added, lets say user1 and user2, and all of them belonging to the www-data group. The www directory has an owner www-data and a group www-data.
I have used chmod -R 775 on the www folder, but after I try to create a folder test through my SFTP server (using Filezilla) the group of the directory created has only r and x permissions, and I am not able to log in with the second user user2 and create a directory within www/test due to a lack of w permission to the group.
I also tried using chmod 2775 on www directory, but without luck. Can somebody explain to me, how can I make it so that a newly created directory inherits the root directory group permissions?
View 2 Replies
View Related
Jun 20, 2010
Firefox opens file listing instead of Nautilus opening file listing.When I access a folder via "Places" -> "Home Folder" or "Places" -> "Downloads", Firefox opens and list the contents of the directory.I have re-installed Nautilus, un-installed Firefox and then going to "Places" -> "Home Folder" or "Places" -> "Downloads" launches Nautilus and I can view the contents normally. Anybody else had this problem with Firefox ? Anybody know how to fix this Firefox problem ?Running Ubuntu Desktop 9.10 64bit.
View 2 Replies
View Related
Mar 23, 2011
I am writing a script, in that my requirement is, if all the fill types stored in one directory from that we need to separate different different directories based on the file types.
for example in a directory(anish). 5 different types files
1- directory
2- .txt files
2- .sh files
like that and my requirement is the (1- directory is moved to one new directory(dir) which we are given in the script)and (2 .txt files are moved to another new directory(test) which we are given in the script)and ( 2 .sh files are moved to another new directory(bash) which we are given in the scrip)finally the directory anish should be empty..using bash script.how it is possible !!
View 7 Replies
View Related
Oct 1, 2009
I am using Red hat linux .. i just wanted to know, is it possible to arrange or sort filenames numerically?i have saved several files with the follwing names : 1.png, 2.png, 3.png, 4.png ...... 11.png 12.png. and so on.... but the containing folder sorts this alphabetically in the following manner 11,12,13...... 1, 2, 3, and so on...
View 6 Replies
View Related
Nov 30, 2010
if i have a dir with several mp3's files:
example:
[root@xxx]ls -l
-rwxr-xr-x 1 web2 client1 6222573 Nov 26 17:34 01 Artist1 - Song1.mp3
-rwxr-xr-x 1 web2 client1 4989384 Nov 26 17:34 02 Artist2 - Song2.mp3
-rwxr-xr-x 1 web2 client1 6987438 Nov 26 17:36 03 Artist3 - Song3.mp3
and i need to update the id3 tag of all files with the command:
/usr/bin/id3v2 -a "Artist1" -t "Song1" Artist1 - Song1.mp3
how i do a loop to read the filename and execute the id3v2 command for each file, as i have filenames with spaces and special chars ex:"".
View 1 Replies
View Related
Jan 29, 2011
I am trying to synchronize the content of the directory my_dir/ from /home to /backup. This directory contains a file which name has a double quote in it, such as to"to. Here is my rsync command:
rsync -Cazh /home/my_dir/ /backup/my_dir/
And I get the following message:
rsync: mkstemp "/backup/my_dir/.to"to.d93PZr" failed: Invalid argument (22)
For info, rsync works well when the synchronized filenames contain single quote, parenthesis and space. Thus, why is it bugging with a double quote?
View 3 Replies
View Related
Feb 5, 2010
What would be the best way to verify files in a folder are all lower case and if a file is not lower case, output the filename to the screen.
View 11 Replies
View Related
Jul 11, 2011
I have a ton of files that are timestamped directories. These all look like2011-06-24_13.53.36 // a directory name for june 24th, 1:53:36 pmI have thousands of these directories. I want to do operations on some of the older ones. Let's say I give it a string for date time that matches that exact format, like i'll give it2011-06-25_00.00.00 // june 25th, 12amI want to find all the directories BEFORE my time. So if i give the string for 12am on june 25th, i want to find all the directories before then.If not i can find EVERY directory i have like this and then filter after wards. The created/modified dates are not tied to the actual timestamp im looking for (that would make this easier)
View 2 Replies
View Related
May 19, 2010
I tried to move a file from my desktop to another folder; moving it was not allowed, for some reason. Neither was opening it and saving a new copy in the target folder. Would that be because the filename contains double (") quotation marks? Are they not allowed? The filename is Edit of Bob's "Lady Liberty" Article.doc. [Filename not enclosed in quotation marks here, to avoid confusion.]I just changed the double quotation marks to single quotation marks; that solved everything.
View 2 Replies
View Related
Oct 5, 2010
I've been surfing and searching the net quit a while now to make my own script, but I haven't been really successful ever since I want to make a script which can remove strings from my mp3 collection (file names).
For example:
Code:
101-bob_sinclar_feat_sean_paul-tik_tok_(radio_edit).mp3 --> bob_sinclar_feat_sean_paul-tik_tok_(radio_edit).mp3
10-Young Jeezy-Lose My Mind (78 Bpm) (Repack).mp3 --> young_jeezy-lose_my_mind.mp3
Now the problem is how can I remove the strings like:
101 & 10 (dynamic)
(%%% Bpm) (dynamic)
(Repack) (static)
View 11 Replies
View Related
Oct 7, 2010
I have a file that contains "ls -la" output. I would like to display only the filenames, none of the other information before it such as permissions, ownership, size, and date.Would the cut command be the best way to hit this, or should I use Vim or sed?
View 6 Replies
View Related
Nov 27, 2010
Is there a way of making rsync (an offspring of rcp) case insensitive? Perhaps mounting the file system (not linux) in some special way?
View 14 Replies
View Related
Dec 10, 2010
Having problems displaying French chars. They are dumped into an nfs share by a Windows/cifs configuration which has been blamed for this unwanted behavior but when I transfer a file continaing � via WinSCP to the RedHat, instead of getting the filename Response.txt I see R?sponse.txt. When I refresh WinSCP to view the file it views it ok.
[Code].....
View 1 Replies
View Related
May 24, 2010
I am trying to write a bash script to delete a file where I know the first part of the name, but it has spaces in it. The second part of the file name is a random set of characters. I was hoping to use a wildcard for this, but I keep getting a error massage saying file or directory does not exist. This is a simplified form of my script:
Code:
MYFILE=This is my file
rm "$MYFILE*"
The file may be something like "This is my file.123abc456.suffix"
View 14 Replies
View Related
Dec 8, 2010
Fox example.I want to rename the files below like this: test1.png、test2.png.....
-rw-rw-r--. 1 test test 20448 2010-12-08 20:11 2010-12-08-212440_1440x900_scrot.png
-rw-rw-r--. 1 test test 29799 2010-12-08 21:25 2010-12-08-212526_369x331_scrot.png
-rw-rw-r--. 1 test test 34167 2010-12-08 23:54 2010-12-08-235424_580x328_scrot.png
-rw-rw-r--. 1 test test 155202 2010-12-08 23:55 2010-12-08-235511_1440x900_scrot.png
View 2 Replies
View Related
May 17, 2010
I would like to search a specific directory and pull out filenames that have this pattern: "_bsc_" Then I want to do some processing and move the file to another directory
View 5 Replies
View Related
Jan 26, 2011
Can anyone offer a code snippet to recursively go through directories and replace any single or double quotes quotes found in a filename with another character (e.g. "_").If any of the filenames contain a single quote or double quote, then replace it with an underscore.
View 7 Replies
View Related
Aug 25, 2011
I have some checksums.md5 verification files from an ntfs external drive, but using windows notation: instead of /, spaces between file names (not escaped), reserved shell characters (like (, &, ', to name a few). The checksums.md5 has a bunch of checksums and filenames:
[code]...
I want to use this checksums.md5 to verify the files that I've copied to my machine: but I'm on a Linux, so I need to convert the names inside checksums.md5 from Windows to Linux to use the md5sum utility from the shell. The first line in my example would become: f12f75c1f2d1a658dc32ca6ef9ef3ffc My Windows & Files (2010)/[bak]/testing.wmv Is there some application for this (converting a file listing, from windows cmd notation, to linux shell notation) or will I need to create a bash script using sed that just "replaces" what is "wrong" with the filenames
View 1 Replies
View Related
Jan 6, 2010
I have an external harddrive which is fat32 (which was filled when I was on a windows system) with a lot of files on (> 200gb) which have mixed case filenames. I wanted to write a script to rename them all to lowercase however when I did I got an error saying that the filenames are the same (which I guess is true as FAT is case-insensitive). My issue is that I'm mounting this from a linux box now so it would make it a lot easier if things were lower case! I've already run a script to replace all spaces with underscores.
I know I could do this by first going through and renaming everything with a prefix and then renaming it back again (ie, rename File.Jpg to xFile.Jpg and then a second rename to strip that x off and rename lowercase to file.jpg) however I find this approach a bit messy and would prefer to do it all in one pass. Other than that, could I change the drive to ext4 without losing any files on it? The drive has a hell of a lot of stuff on there which is an archive of many years of files - I'd be absolutely gutted if I lost everything.
View 2 Replies
View Related
Jun 9, 2011
I'm working with an embedded Linux (Montavista 5.0). I want to allow users of my program to choose filenames with Unicode chars like the German All Unicode chars are visible inside the program (dialogs, buttons,...) and I can write Unicode chars into files and read them. But it is not possible for me to create a file with an Unicode filename! I can't write such Unicode chars in the shell! I set my locals to "de_DE.utf8". locale charmap says UTF-8! But when I try
Every Unicode char is writte to the shell in this way with a leading The same happens when I write such chars from my program to the shell with printf!
View 1 Replies
View Related
May 18, 2010
Suppose I have a variable called filename which contains the name of a file but the name does not contain an extension.
View 4 Replies
View Related
Oct 13, 2010
I presume that if this is possible it would need to be done as root (or as a user who shares root's UID of 0).How can a process be launched so that it does not show up in a ps aux or ps ef or top listing if the command is run by non-root?Is this even possible?The distributions I typically run are RHEL/CentOS and Ubuntu - so if there is a distro-specific answer, that's ok, too.
View 1 Replies
View Related
Sep 3, 2011
Is it possible for a non-root user to hide themselves from the output of who/w, so that they can be logged in without other users seeing it? I think that the file /var/run/utmp might have something to do with this, but it's not writeable by non-root users (permission 644). I'm fairly certain that this can be done by a non-privileged user (because someone told me that they were able to do so), but I don't know how they did it and can't ask them right now.
View 1 Replies
View Related
Jan 21, 2010
I can't seem to find a way to do this, so maybe it's not actually possible, but I was wondering if there was a way to list all files that link to a file.
For example.
touch a
ln a b
ln a c
I want to find out what files link to a (not symlinks, mind you), assuming that this is more complicated (they are spread around to different directories).
I kind of understand about the filesystem storing links in one area and data in another, so I understand it probably takes more work to find a link from a file location than the other way around.
View 1 Replies
View Related