get file size EURGENT!!

I've been trying all night to get this to work, but everything i do give me a compile or runtime error.

currently I'm using file_size() (no idea what to include inside the brackets).

Also if you have can help with any of the following it would help me greatly:

-list the files in reverse order
-show all files (including hidden files)(dont know if its doing that now, if so then i need to switch it so its off by default)
-how to display the filename (example.txt)

ya funny, i just got it to work as you posted that... anyways i'm having a little problem printing out the sub directories. and ideas why?

EDIT: actually is there another way to do the "process all folders recursively" part without using an outside method, i can't assign switch variables to the method due to it not being inside the main class. so can you show me how to add it on to the one inside the class

I don't know what you are asking. Verbosity is a good thing when asking a technical question. You should probably have a function for each of the switches but you need to list what each is for. Can there be multiple switches?

There is a function i have at the top it is being used to go into sub directory's. For some reason it isn't working now, I wanted to have the whole program work within the "main" class. So i need that function at the top to be worked into the one inside the class. Also it is possible to have more then one switch at a time, so if that happens, then i would want to turn on the features inside that one loop. This cannot be done if its outside of the main (as far as i know).

I think you are going in the wrong direction. You should be creating functions, like your show_files_withR function, instead of integrating it into your main function (classes are a very different thing).

What does each of the switches do? You can pass switches as parameters to your function, if you need access to them in there.

but i can have say -lRa together so, your saying to have every function for each combo possible?

As for what each switch does:

• R: process all folders recursively.
• r: list the files in reverse order.
• a: show all files (including hidden files)
• l: show the following details:
o Display the letter ‘d’ if the file is a directory, dash (‘-‘) otherwise.
o Display the size of the file in bytes
o Display the folder name after the file name if the –R switch was chosen.

I guess it would be easier to have many different functions but then i still have the problem with regular expressions, those would still have to be passed up, its just impossible to have a function for every outcome for that!

Now that I see what the switches do, no you wouldn't want functions for each operation.

Start with the simplest task and forget how you will integrate the switches into everything. Take it one step at a time.

Can there be no switches? Is the program to just display the files in one directory in that case? If so, that's a good place to start. If not, start with displaying all files or displaying files in reverse order. Then build from there.

Well there always has to be one swith, right now i'm going to work with the -l switch, i have it already displaying the d: or -: and file size, just need to know how to display the folder name its in, not the whole path. And what would i use to go in reverse order?

EDIT: also should i use a function or not?

EDIT2: ok i was stupid, i figured out how to pass up data to the function. anyways, i still need to know how to show only the folder its in and just remembered i need to know how to just show the file. so it should look likethis:

Just to get back on track and clear up any confusion in the thread this is what i have left to do and could use help on:

1. SWITCHES:
r: list the files in reverse order.
a: show all files (including hidden files)
l: show the following details:
DONE -Display the letter ‘d’ if the file is a directory, dash (‘-‘) otherwise.
DONE -Display the size of the file in bytes
-Display the folder name after the file name if the –R switch was chosen.

2. add in regular expressions
3. make path and regular expression in 1 cmd line arg, this means finding a way to split the 2
4. multiple switches, same as 3(each switch needs to be split up)