473,385 Members | 1,780 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

loop files in folder

I need to write a program that will read the contains of a folder
and output it into a text file. the folder will contain files with
extensions
..000 .001 .002... and so on, plus many .txt, .tif, and .htm files
basically the output text file as to be in the following format;

Y
1
1
1
filename.000
y
2
filename.001
y
4
filename.tif
y
3
filename.txt
n

the first 5 lines will always be the same, after that it as to add
'y','2' if the extension is .00#
'y','3' if the extension is .txt or .htm, and 'y','4' if the extension
is .tif or .jpg

any ideas?
thanks :)
Jul 19 '05 #1
4 11676
> I need to write a program that will read the contains of a folder

afaik there are only system-calls for directory functions (looping through
all the files in a dir, c++ only handles files)
try the msdn-site for windows, or the manpages for linux/unix and you should
find what you need.

regards,
sev
Jul 19 '05 #2
"Severin Ecker" <se****@gmx.at> wrote in message news:<3f***********************@aconews.univie.ac. at>...
I need to write a program that will read the contains of a folder


afaik there are only system-calls for directory functions (looping through
all the files in a dir, c++ only handles files)
try the msdn-site for windows, or the manpages for linux/unix and you should
find what you need.

regards,
sev


Thanks for the response,

I don't need the script to see the folder itself, I will CD to the
folder and run the
Script on the files in the folder, can I work with this?
Jul 19 '05 #3
hi!
Thanks for the response, np
I don't need the script to see the folder itself, I will CD to the
folder and run the
Script on the files in the folder, can I work with this?

if the script simply gets a list of filenames (e.g. through stdin) there's
no problem with that solution.
it's up to you how you generate that list,.. eighter you make the input by
hand, or use the output of a prog that lists all the files in the folder.

hope, this helps.
regards,
sev
Jul 19 '05 #4
"Severin Ecker" <se****@gmx.at> writes:
I need to write a program that will read the contains of a folder


afaik there are only system-calls for directory functions (looping through
all the files in a dir, c++ only handles files)
try the msdn-site for windows, or the manpages for linux/unix and you should
find what you need.


AFAIK the boost filesystem library does exactly this in a system-independent
way - check www.boost.org

HTH & kind regards
frank

--
Frank Schmitt
4SC AG phone: +49 89 700763-0
e-mail: frankNO DOT SPAMschmitt AT 4sc DOT com
Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: build | last post by:
G'day All, I have a problem with this loop. There are a number of .txt files in 'myPath'. tmpFile = Dir(myPath & "\*.txt") 'PROCESS FOLDER Do Until tmpFile = "" <lottsa code> <too much to...
4
by: AndrewM | last post by:
Hello, I have a SUB which has input variables. If I run it once its okay, but I need to include it in a for....next loop. Can this be done ? for i=0 to 100 call mySub(arr(0,i)) next
1
by: PaulMac | last post by:
Hi, I need to be able to retrieve the file name and file size for all the tif files in a particular folder... The number of files will vary, so it will have be a loop. I can count the...
0
by: satish | last post by:
hi, i have a problem while connecting the Folder in executing sql task in execute sql statements in loop example in Intergration Services --2005 the actual problem -- i have given the sql source...
1
by: rdemyan | last post by:
I'm using DIR to loop through files in a folder and it's working fine. But can I control the order of the looping. For example, the first file would be the file with the most recent Date Modified...
0
by: 1333 | last post by:
I need to create a new folder every time the upload folder has 10 files uploaded to it. So when folder1 has 10 files, folder2 is created and becomes the upload folder, and when it has 10 files...
2
by: fniles | last post by:
I would like to loop thru all the files in a folder. For ex: I have a folder c:\temp and inside that folder there are many zip files. I want to read each zip files in c:\temp. How can I do that ?...
2
by: kumarboston | last post by:
hi all, i am processing a certain number of files from a directory and each file has around 5 columns and 200 rows with tab separated values. I am trying to grab each file and calculate the average...
0
by: TG | last post by:
hi! I am working with VB 2008. I want to be able to run this program say in N:\ and it will show me in an excel sheet the following: Folder Path Size(GB) Count of Files N:\Clients 0.53 308 ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.