Pass File name and Directory Path through command to python script
I'm writing python script to get the file-names in the current directory and file sizes .I'm able to get file list and their sizes but unable to pass them through command line. I want to use this script to execute on other directory and pass directory path with file name through command line. Any suggestions ?
current script
I want to use this script to execute on other directory and pass directory path with file name through command line
example : python filelist.py filename directory_path
Moderator's Comments:
Please use code tags as required by forum rules!
Last edited by RudiC; 06-09-2016 at 02:41 PM..
Reason: Added code tags.
Hi,
I have a file abcd.txt which has contents in the form of full path file names i.e.
$home> vi abcd.txt
/a/b/c/r1.txt
/q/w/e/r2.txt
/z/x/c/r3.txt
Now I want to retrieve only the directory path name for each row
i.e
/a/b/c/
/q/w/e/
How to get the same through shell script?... (7 Replies)
I have N number of python scripts which i am receiving from REST web server and i am saving them in /home/mandar/ . Now i want to write a script to run all the python scripts from this directory and monitor them every minute...if any process is dead or hung it should be restarted by this script.
... (0 Replies)
I have a below directory name
/root/logs/testing/today/
Here i have get to the value as '/root/logs/testing/' only without the last directory in a shell script. Do i need to use substr function here. Is there any other way around (6 Replies)
I have a script like this running under OS X 10.8. The problem arises when the find command encounters a space in the path name. I need the "dir" variable as I'll be extending the script to more general use.
#!/bin/bash
CFS=$IFS
IFS=$(echo)
set dir = "/Users/apta/Library/Mail\... (3 Replies)
Hello,
i have:
# python -V
Python 2.7.6
But original for my CentOS is 2.3 or 2.4
my python folder:
/root/python2.7.6
(inside are folders like lib, include, bin, share)
I launched app iotop:
# iotop -od 6
Traceback (most recent call last):
File "/usr/bin/iotop", line 16, in... (3 Replies)
Hello gurus,
I have a csv file with bunch of datas in each column. (see attached)
Now I have an .xml file in the structure of below:
?xml version="1.0" ?>
<component id="root" name="root">
<component id="system" name="system">
<param name="number_of_A" value="8"/>
... (5 Replies)
Hi All,
In this path /home/all_files
we have follwing files and direcotries
proc_edf_sot.sql
proc_ssc_sot.sql
func_dfg_sot.sql
sot
unic
cmr
sdc
under sot directory we have other directories
sql
pas
ref
under sql directory we have
sql_sot
sql_mat (6 Replies)
Hi Experts,
I am working one one python script in version 3.x and 2.6. Need your support to complete it
Basically for both commands i have telnet to device and run command and then receiving input File 1 and File 2
I have two commands, need to grep data and output in csv file.
Next script/code... (0 Replies)
Experts,
I am writing a script and able to write only small piece of code and not able to collect logic to complete this task.
In input file have to look for name like like this (BGL_HSR_901_1AG_A_CR9KTR10) before sh iss neors. Record this (BGL_HSR_901_1AG_A_CR9KTR10) in csv file
Now have to... (0 Replies)
Hello,
I am creating a file with all the source folders included in my git branch, when i grep for the used source, i found source included as relative path instead of absolute path, how can convert relative path to absolute path without changing directory to that folder and using readlink -f ? ... (4 Replies)