Create a Copy of Files

C

CBFalconer

Hans said:
Yes, I know that.

The scenario is this. I download a lot of ebooks--PDF's, CHM's,
DJVU's, etc. I want to create a separate index using the operating
system's folders as a kind of catalog and store the ebooks
elsewhere. My solution is to create proxy files for the ebooks
(i.e., empty text files with the same names as the original). The
text files now become like catalog cards in the library. One
"catalog card" (text file) will have the ISBN in front and another
has the book name in front.

I need to do the creation of the files in bulk because I download
like hundreds of ebooks per day. So, the cataloging part is really
slowing me down.

I think you are over complicating the project. You have a herd of
filenames, which names are not complete without the path to their
directories. Yet you want to be able to easily update that path.
Also some other information is probably required.

I would design a structure that holds the information. Path and
filename are obviously strings. Searching has to be on the basis
of both. Other information is just carried along.

With that structure you can simply use a hashtable. You will need
to design a way to dump the table to a file, so you can recreate it
as needed. But the table will provide rapid searching and access.
I would suggest you look at hashlib.zip, to be found at:

<http://cbfalconer.home.att.net/download/hashlib.zip>

which is purely standard C and licenced under the GPL. I.e. free.
The file include application examples.
 
C

CBFalconer

Keith said:
.... snip ...

If you're going to snip quoted text, can you please do us all the
simple courtesy of marking it somehow? "[snip]" and "[...]" are
commonly used markers.

If you look, you will see that I always mark snipped areas. I
don't mark snippage after my answer, because my answer is not
dealing with that.
 
K

Keith Thompson

CBFalconer said:
Keith said:
... snip ...

If you're going to snip quoted text, can you please do us all the
simple courtesy of marking it somehow? "[snip]" and "[...]" are
commonly used markers.

If you look, you will see that I always mark snipped areas. I
don't mark snippage after my answer, because my answer is not
dealing with that.

Ah, but you snipped the part that explained why your answer made no
sense.

Please mark snippage after your answer. Failing to do so tends to
imply that you've quoted the entire article. Adding a "[...]" isn't
that hard.
 
H

Hans

I think you are over complicating the project.  You have a herd of
filenames, which names are not complete without the path to their
directories.  Yet you want to be able to easily update that path.
Also some other information is probably required.

I would design a structure that holds the information.  Path and
filename are obviously strings.  Searching has to be on the basis
of both.  Other information is just carried along.

With that structure you can simply use a hashtable.  You will need
to design a way to dump the table to a file, so you can recreate it
as needed.  But the table will provide rapid searching and access.
I would suggest you look at hashlib.zip, to be found at:

   <http://cbfalconer.home.att.net/download/hashlib.zip>

which is purely standard C and licenced under the GPL.  I.e. free.
The file include application examples.

You should know from my post that my knowledge of C is very limited.
I'm using my programming knowledge to solve a real-world problem I
have. It has priority. It looks like I'll be doing a lot to solve
"programming problems" with your proposed solution.

Anyway, I was able to write a "working" program to satisfy my specs.
Now, I can focus on other things.
 
C

CBFalconer

Richard said:
CBFalconer said:
Keith said:
... snip ...

If you're going to snip quoted text, can you please do us all
the simple courtesy of marking it somehow? "[snip]" and "[...]"
are commonly used markers.

If you look, you will see that I always mark snipped areas. I
don't mark snippage after my answer, because my answer is not
dealing with that.

Yet you've told other people off for snipping in precisely that
way for precisely that reason.

You are either lying or are sorely confused.
 
A

Antoninus Twink

Hans said:

That's all right. So is Chuck's.

Miaow!

I think this is working out pretty well. I've noticed that Heathfield
has been noticeably less aggressive towards Jacob recently (still snide,
of course), possibly a bit deflated after the reaction to his
"Rosewater" sock puppet.

It looks like he's found someone else to bully instead - and it couldn't
have happened to a nicer guy!
 
K

Kenny McCormack

Heathfield is an angel compared to that nasty jobsworth Chuck
Falconer. Falconer is an over opinionated incompetent : nothing more,
nothing less.

The death any religion (or, more generally, any non-reality-based
Establishment) is when the people running it start squabbling publicly
amongst themselves. At that point, the common man starts to see the
cracks in the walls, and they lose faith.

This is clearly happening to CLC as we speak.
 
G

Guest

I'm still working on the code placement. This was just to show that
the ISBN switch worked.

As for the dirent.h, it was from this webpage at the cprogramming.com
forum:

http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1046380353&id...

I also checked the dirent.h file. It happened to be included in the
Bloodshed Dev-C/C++ compiler so it must be common or standard.

it's a common extension. And since you want to walk directories
and the C standard doesn't provide for this you're going to have
to use such an extension. See if it has some sort of "filter"
option if you want to limit which files you see.
 
K

Keith Thompson

Richard Heathfield said:
CBFalconer said:
Richard said:
CBFalconer said:
Keith Thompson wrote:

... snip ...

If you're going to snip quoted text, can you please do us all
the simple courtesy of marking it somehow? "[snip]" and
"[...]"
are commonly used markers.

If you look, you will see that I always mark snipped areas. I
don't mark snippage after my answer, because my answer is not
dealing with that.

Yet you've told other people off for snipping in precisely that
way for precisely that reason.

You are either lying or are sorely confused.

I'm not lying, and I'm not the one that's confused.

I'm going to give you one example:

<[email protected]>
[...]

Not quite. In that article (which Google Groups makes it inordinately
difficult to find, BTW) Chuck criticized me for snipping a paragraph
from an article of his. I had clearly marked the snippage with
"[...]". My current complaint is that Chuck snipped content without
marking it, which could imply to a reader of Chuck's followup that he
had quoted the entire article.
 
B

Ben Bacarisse

Spiros Bousbouras said:
Richard Heathfield said:
I'm going to give you one example:

[...]

Not quite. In that article (which Google Groups makes it inordinately
difficult to find, BTW) [...]

How about a link then? And how did you go about finding
it? I wasn't able to.

The thing in <>s is a message ID. Google Groups can look up a message
by ID (the separate form at the end of the "advanced" search page).

http://groups.google.co.uk/group/co...59/c091811f018de02b?hl=en&q=#c091811f018de02b

I much prefer IDs to be posted since my reader will show me them
directly (if there are still on the server) and the GG solution works
reasonably well for older poists that have gone from my server.
 
K

Keith Thompson

Spiros Bousbouras said:
Richard Heathfield said:
I'm going to give you one example:

[...]

Not quite. In that article (which Google Groups makes it inordinately
difficult to find, BTW) [...]

How about a link then? And how did you go about finding
it? I wasn't able to.

Google Groups Advanced Search lets you search for an article by
message-id (you have to drop the '<' and '>'), but it shows you the
entire thread. I then went into Options to show the tree view and
searched it for articles by the same author until I found the right one.

Apparently GG has decided that threads are important and individual
articles are not.
 
S

Spiros Bousbouras

Spiros Bousbouras said:
I'm going to give you one example:
<[email protected]>
[...]
Not quite. In that article (which Google Groups makes it inordinately
difficult to find, BTW) [...]
How about a link then? And how did you go about finding
it? I wasn't able to.

Google Groups Advanced Search lets you search for an article by
message-id (you have to drop the '<' and '>'), but it shows you the
entire thread.

Well I just tried Groups Advanced Search for the first time and
the link I got (tiny version is http://tinyurl.com/onbz9b) took
me directly to the post.
 
K

Kenny McCormack

What happened to your amit.codebase nym or whatever it was?

que?

This is the only name I've posted with in years.[/QUOTE]

There was that time, back in '87, I think, where somebody actually
admitted to running a sock puppet.

(For the terminally clueless - i.e., CLC regs - this means: Your denial
is meaningless)
 
G

Guest

There was that time, back in '87, I think, where somebody actually
admitted to running a sock puppet.

(For the terminally clueless - i.e., CLC regs - this means: Your denial
is meaningless)

contrariwise the charge in meaningless
<shrug>
 
R

Richard Bos

Keith Thompson said:
Spiros Bousbouras said:
I'm going to give you one example:

<[email protected]>

Not quite. In that article (which Google Groups makes it inordinately
difficult to find, BTW) [...]

How about a link then? And how did you go about finding
it? I wasn't able to.

Google Groups Advanced Search lets you search for an article by
message-id (you have to drop the '<' and '>'), but it shows you the
entire thread. I then went into Options to show the tree view and
searched it for articles by the same author until I found the right one.

Google Groups Broken Beta is not the only website which lets you search
on a Message-ID. Try, for example, <http://al.howardknight.net/>.

That, BTW, is why a Google Beta link is always worse than a Message-ID.
The latter always remains as valid as it was when posted; the former is
only useable at Google's whim.

Richard
 
K

Keith Thompson

Google Groups Broken Beta is not the only website which lets you search
on a Message-ID. Try, for example, <http://al.howardknight.net/>.

Cool, I'll have to try that.
That, BTW, is why a Google Beta link is always worse than a Message-ID.
The latter always remains as valid as it was when posted; the former is
only useable at Google's whim.

Which is why I've started citing both. URLs, when they work, make it
easier to pull up an article quickly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,281
Latest member
Pedroaciny

Latest Threads

Top