Visit Our UNIX and Linux User Community


Sizeof a file from directory path in perl


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Sizeof a file from directory path in perl
# 1  
Old 08-28-2013
Sizeof a file from directory path in perl

Hai

how to find size of a file??

ex : /home/kiran/pdk/sample/calibre this is a path
In that I have to find size of a files in side a calibre(it is the folder) like .results or .summary
# 2  
Old 08-28-2013
Code:
Last login: Wed Aug 28 13:27:05 on ttys000
AMIGA:barrywalker~> cd /
AMIGA:barrywalker/> wc -c /Users/barrywalker/.bash_profile
      26 /Users/barrywalker/.bash_profile
AMIGA:barrywalker/> _

EDIT:

Oh bother...

Just noticed it is perl you wanted:-
Code:
#!/usr/bin/perl -w
exec "wc -c /Users/barrywalker/.bash_profile"

Results on screen using a Macbook Pro...
Code:
Last login: Wed Aug 28 15:00:19 on ttys000
AMIGA:barrywalker~> perl exec_me.pl
      26 /Users/barrywalker/.bash_profile
AMIGA:barrywalker~> _

This assumes that everyone has read access to the hidden file...

Last edited by wisecracker; 08-28-2013 at 11:08 AM.. Reason: Just realised perl was needed...

Previous Thread | Next Thread
Test Your Knowledge in Computers #327
Difficulty: Easy
The Windows 7 operating system has seven main editions.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

What is the difference ../directory path and ./directory path in ksh?

What is the difference ../directory path and ./directory path in ksh? (1 Reply)
Discussion started by: TestKing
1 Replies

2. UNIX for Beginners Questions & Answers

Convert Relative path to Absolute path, without changing directory to the file location.

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)
Discussion started by: Sekhar419
4 Replies

3. UNIX for Beginners Questions & Answers

A file or directory in the path does not exist

I'm brand new to AIX and I looked up how to print this file and it was working but now I'm not able to do it all of a sudden. the file name is rom1.txt so this is what i wrote in the command line and I know I'm in the right directory. In bold is what I seem to be messing up with. prod @ root... (3 Replies)
Discussion started by: Dark0Prince
3 Replies

4. UNIX for Advanced & Expert Users

How can i assign directory path to a variable in perl?

Hai how can I assign directory path to a variable in perl Thanks&Regards kiran (3 Replies)
Discussion started by: kiran425
3 Replies

5. UNIX for Dummies Questions & Answers

How can i assign directory path to a variable in perl?

Hai how can I assign directory path to a variable in perl Thanks&Regards kiran (2 Replies)
Discussion started by: kiran425
2 Replies

6. Shell Programming and Scripting

How to search/replace a directory path in a file using perl

Hello All, Here is what I am trying to do and maybe you guys can point me in the right direction. I have a file that contains the following string(s): WARNING: </d1/test/program1> did not find item1 WARNING: </d1/test/program1> item1 does not exist WARNING: </d1/test/program2> item1 failed... (1 Reply)
Discussion started by: maxshop
1 Replies

7. Shell Programming and Scripting

Retrieve directory path from full file path through sh

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)
Discussion started by: royzlife
7 Replies

8. Shell Programming and Scripting

Copy last modified directory from path using Perl

Hi I need to copy last modified directory from path /users/bin to be copied to /tmp in a perl script ...somehow my script is not allowing me to do cd /users/bin. i have tried $dir = `find /users/bin -maxdepth 1 -type d -mtime 0 ` cp -R $dir /tmp/new but it says missing destination... (1 Reply)
Discussion started by: shaveta
1 Replies

9. Shell Programming and Scripting

Perl directory path in array

Hi anyone can help how put the directory in array in perl.eg directory paths below:- /home/user/ /home/admin/ /var/log/ IF path eq /home/user/ then the files moved to /data/user/ IF path eq /var/log/ then the files moved to /data/log/ Thanks (1 Reply)
Discussion started by: netxus
1 Replies

10. Programming

sizeof an array of structure without using 'sizeof' operator

Hi All, is it possible to find out the size of an array of structures ( without using 'sizeof' operator). The condition is we have the array of structure instant but we are not aware of the elements inside the structure. Can someone help me out? Thanks in advance. (18 Replies)
Discussion started by: rvan
18 Replies

Featured Tech Videos