Ubuntu :: Get A Recursive Listing Of All Files Under The Current Directory?
Jan 2, 2011
If I runls -R1I get a recursive listing of all files under the current directory.However, if I dols -R1 *.avi, ie I want to search only for files with the file descriptor .avi, I get an errorQuote:ls: cannot access *.avi:No such file or directorySo it seems I am using ls incorrectly. What's the correct way to use wild card pattern matching when using the -R switch? Or maybe that isn't possible?
how to pipe the current directory listing into sort so that the output is the date in descending order (primary sort key). If there are multiple entries with the same date, I'd like the times sorted in ascending order. It seems simple but for some reason this isn't working:
ls -l | sort -k 6r -k 7
For some reason it doesn't seem to ever get to the second sort key when using column 6 (last modified date).
I am writing a shell script that finds all files named <myFile> in a directory <dir> or any of its subdirectories, recursively. I also need to take care of symbolic links that may form cycles, to avoid infinite loops. I am not supposed to use find command for the same
I started writing the code but got stuck. I thought using recursion may be a smart way, but its not working.
I think as a result of a script that started duplicating files in a loop, the allotted capacity on my VPS filled up with multiple nested copies of the same files... After a reboot, I could delete most of them, but got rm stalled in certain directories...
after isolating which ones, I found this: a directory listing that lists the files, and at the same time tells me they are not there!!!
Code: ls ls: cannot access userkey.php: No such file or directory ls: cannot access workshop.php: No such file or directory ls: cannot access quiz.php: No such file or directory ls: cannot access webservice_rest.php: No such file or directory
When I run:make -f mymakefile clean I get:rm -f mybinary *.so.* *.dep *.o mybinary.symand all the above files are removed from the current directory.But I have a directory /src/ where I have all my source files located. The *.o file in this directory are not removed?
I have RHEL5 with apache installed and running. I have a directory off of / called software that I would like to have show up as a directory listing so if I go to [URL] I get the directory listing. I have tried searching around and nothing seems to work for me. So out of the box how do I get this to work? My server properly resolves to [URL] so I am good there.
I'm having problems with compiling recursive Makefiles in my directory structure: My folder layout is: top/|- one/|- one.c (With main function)|- zero.c|- two/|- two.cin my top folder the make file looks like:
Code: MAKE_DIRECTORIES = one two .PHONY: all all: $(MAKE_DIRECTORIES)
.PHONY: $(MAKE_DIRECTORIES) $(MAKE_DIRECTORIES): @echo $@ $(MAKE) --directory=$@ in my one and two folder I have the following Makefile:
Code: .PHONE: all all: @echo $@ $(CC) $(CFLAGS) *.c But when I compile it from top folder: make
I get following output: Code: one two Which states that directory statement by echo in main Makefile is ok but the files are not compiled in one and two.
I would like to make a cronjob who makes a tag.gz of everything inside a directory in a recursive way. BUT there is a HUGE directory full of jpg's. I don't want this one in the backup.Additional points if it can backup symbolic links.
I know grep can search recursively (ie through all subdirectories to the bottom of the directory tree), but is it possible to ask grep to only search say, 3 levels down? That means the current directory, any directories in the current directory, and within any directories within those?
I have set up Ubuntu 9.1 with Samba etc. as a web server. The files are in /var/www and are shared through Samba as web. The root directory and sub directories have index.htm files in them but unfortunately except for the root directory users can see the directory listing rather than the directory automatically producing index.htm. This is obviously causing security problems. How to prevent directory browsing by users coming into the server over the internet by a redirect URL from another site. E.g. [URL] where bigwebsite is a domain registered with a change ip server because I have a service which dynamically allocates an IP Address.
Within the mv() command is there any way to not need to type the entire directory location? In the example there are directories with varying depths... I want to move a file from depth 2 to a directory of depth 3 when the directory of depth 3 is within the directory of depth 2. Basically, can I cp() andor mv() a file to a subdirectory without having the enter the entire directory location?
[root@xxx dir]# ls dirD1 [root@xxx dir]# cd dirD1/dirD2 [root@xxx dirD2]# ls
This is the script I'm running tar tf some.tar somefolder_insidetar And output it's a list with all folders, files, and SUBDIRECTORY Files, the only thing I need it's just show the contents (folder and files) of the current directory choosed, not listing subdirectory files, or subdirectories inside subdirectories.
Is there a command to return a recursive listing of sub-directories and the number of files in them? I have found plenty of ways to give me the total number of files in a directory structure, but none that gives a list of the sub-directories with the number of files in them. "du" gives me a listing of directories with their sizes, but I couldn't find an option (or any other way) to give me the number of files as well. Ideally, I'd like to get list with "Size" "Files" "Dir name" - And the order of the columns doesn't matter. Is there a "simple" command line solution or do I need a shell script for that?
I have, for example, a folder called "MyFolder" and it contains 3 files: MyFile1, MyFile2, MyFile3. The only file that I do NOT want a particular user/group to even see that it exists is, for exmple, MyFile2.So, when they do a directory listing on MyFolder, they should only see MyFile1 and MyFile3. How can this be done in Linux? The important thing is that it is not just preventing them from "executing" MyFile2, but to prevent them from even knowing that it exists by not including it in a directory listing.This is a simpified example using one file, but in reality, I have lots of files and some of those that I want to block are also subfolders.It is very important for me to hide the existence of certain files/folders when the user does a directory listing. It's also important that the files stay in their current folder (that is, I can't use a workaround which requires moving all the files into a separate folder and then securing that folder).
I have a user who just got a new laptop and when he connects to the FTP server, it verifies his username and password like it should, but when it goes to do the directory listing, it just kinda sits there. if i refresh the view, the folders show up. wonder if there's something in a log somewhere for vsftp i should be looking at. it could just be his ftp client or air card too, but i want to be thorough on the server too becuase it will help me learn.
I am trying to make my Apache server show symbolic links in a directory listing, but have so far been unsuccessful. In my latest attempt, I have placed the following code in .htaccess, in the directory with the symlinks that I want listing:
Code: <Directory /> Options All </Directory> Im httpd-vhosts.conf, I have also placed the following code within the relative <VirtualHost></VirtualHost>: