Sponsored Content
Top Forums Shell Programming and Scripting How can i sort this listing in PYTHON by folder creation? Post 302989827 by ZerO13 on Wednesday 18th of January 2017 03:40:38 PM
Old 01-18-2017
How can i sort this listing in PYTHON by folder creation?

Is there anything i can do about this code? I need to sort it by folder creation, the newest will be first ... thx Smilie

Code:
for dirname in postme:

                                      dirname = os.path.abspath(dirname)

                                      if dirname:

                                          self._gal_files(os.path.basename(dirname), os.listdir(dirname), basepath=dirname)

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Listing the creation date/time of a file in unix

Hi, I need the unix command which returns only the file name and its creation date/time in unix. I tried ls -l <filename>. But that is giving other details also which I do not want. Could anyone help me out? Thanks. (6 Replies)
Discussion started by: unipepper
6 Replies

2. UNIX for Dummies Questions & Answers

folder creation

Hi, help me to write a shell script to check the folder is exsting as with the current date in specified path,and if not exsting ,i need to create a folder with name as the current date Thanks (1 Reply)
Discussion started by: rujupriya
1 Replies

3. Shell Programming and Scripting

Creation of log file under dynamic date folder

HI I want to create a date folder and then a log file under it, which will hold all output of shell script. Say shell script abc.sh runs every day and I want to redirect the output of abc.sh > /opt/bea/wls81/Pkmtest/$(date +%Y%m%d)/ant.log. Here date should always change according to system... (2 Replies)
Discussion started by: pankajkrmishra
2 Replies

4. Shell Programming and Scripting

Perl file and folder listing -Help

Hello, I want to display all files and folders in a drive under windows. I tried two ways. 1-Way Here is the code snippet. opendir DIR, "F:\"; # Searching under F drive my @files = readdir(DIR); # Reading eveythg under F drive closedir DIR; # closeing the directory handler foreach my... (4 Replies)
Discussion started by: coolbhai
4 Replies

5. UNIX for Dummies Questions & Answers

List directories with given string, sort by creation date

It is for HP-Unix B.11.31. Requirement: 1. List the directories, which directories name has given particular string. Example: Directories with name "Build" 2. On the output of 1. list the directories by creation date as sort order. I tried with; find . -type d -name "Build*" ... (3 Replies)
Discussion started by: Siva SQL
3 Replies

6. UNIX for Dummies Questions & Answers

Shell script folder creation

hi can any one help me in shell scripting where in my requirement is to write a shell script where in if i run that script i should copy all the .doc files from one system to another systems within a network like from parent folders to child folder example parent folder A within parent folder... (5 Replies)
Discussion started by: afra
5 Replies

7. UNIX for Dummies Questions & Answers

Select all files in a folder based on creation date (ls command)

Hi All, <Re-posting in Correct group> I'm trying to select all the files in a folder that starts with a particular name format and are created in a gven date range using 'ls' command...but i'm not successful.... Example : I'm trying to see all the text files in a folder who names start... (6 Replies)
Discussion started by: Satya C1
6 Replies

8. Shell Programming and Scripting

Need help in finishing a bash script for listing subfolder by size in a large folder

Greetings everyone. I have seen that you do wonders here. I have a large folder on a Ubuntu linux. Organization main folder, inside 20 000 subfolders, and inside those subolders many other like 5-6 folders and files. I am interested to create an output to a txt file under the bash... (2 Replies)
Discussion started by: ultimo
2 Replies

9. Programming

Python Regex List Creation

Here is a snippet of my code: blahblahblah... blah for link in goodies.soup.find_all('a'): blah.append(link.get('href')) blah=list(set(blah)) which gives my list of urls. So now I use a regex to search for the relevant urls which I want in a list: for r... (0 Replies)
Discussion started by: metallica1973
0 Replies

10. Shell Programming and Scripting

Script to move files and Creation of folder structure

We are receiving few zipped files in one location say : apple/oranges/incoming All .zip files are placed here in incoming folder. So few of the files are password encrypted. There are only 10 zipped files, so we are planning to create a script which will pick that zip file from incoming... (1 Reply)
Discussion started by: Sidhant
1 Replies
DIRNAME(3)						   BSD Library Functions Manual 						DIRNAME(3)

NAME
dirname -- report the parent directory name of a file pathname LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <libgen.h> char * dirname(char *path); DESCRIPTION
The dirname() function takes a pointer to a character string that contains a pathname, path, and returns a pointer to a string that is a pathname of the parent directory of path. Trailing '/' characters in path are not counted as part of the path. If path does not contain a '/', then dirname() returns a pointer to the string ``.''. If path is a null pointer or points to an empty string, dirname() returns a pointer to the string ``.''. RETURN VALUES
The dirname() function returns a pointer to a string that is the parent directory of path. SEE ALSO
dirname(1), basename(3) STANDARDS
o X/Open Portability Guide Issue 4, Version 2 (``XPG4.2'') o IEEE Std 1003.1-2001 (``POSIX.1'') BUGS
If the length of the result is longer than PATH_MAX bytes (including the terminating nul), the result will be truncated. The dirname() function returns a pointer to static storage that may be overwritten by subsequent calls to dirname(). This is not strictly a bug; it is explicitly allowed by IEEE Std 1003.1-2001 (``POSIX.1''). BSD
May 10, 2008 BSD
All times are GMT -4. The time now is 09:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy