Category : C Source Code
Archive   : JAZLIB.ZIP
Filename : RENFILE.DMO

 
Output of file : RENFILE.DMO contained in archive : JAZLIB.ZIP
#include
main(argc,argv)
int argc;
char **argv;
{

/* various work variables */

int werr,wrenerr,w;
TDIR wdir;
char woldpath[50],wnewpath[50],woldname[100],wnewname[100];
char wspec[50];

if (argc != 3) { /* not enough args */
printf("\nRENFILE by Jack A. Zucker @794-5950 | 794-8763 | 937-9500");
printf("\nThis program allows renaming files across subdirectories");
printf("\nbut unlike previous versions, accepts wildcards");
printf("\nUSAGE: renfile ");
exit(1);
}

strcpy(woldpath,argv[1]); /* parse out path from old file name */
w = rindex(woldpath,'\\'); /* see if there is a path specified */
woldpath[++w] = '\0'; /* woldpath now contains only the path */
strcpy(wspec,argv[1]+w); /* wspec contains only the file spec */

strcpy(wnewpath,argv[2]); /* get new name */
w = rindex(wnewpath,'\\'); /* look for and get rid of trailing '/'*/
if (w == (strlen(wnewpath)-1)) /* new name ends in '/' */
wnewpath[w] = 0; /* get rid of '/' */

werr = jzfndfst(argv[1],32,&wdir); /* start directory search */

if (! werr) /* zero indicates we got a dir item */
do {
strcpy(woldname,woldpath); /* concatenate wdir.name to path */
strcat(woldname,wdir.name);
strcpy(wnewname,wnewpath);
strcat(wnewname,"\\");
strcat(wnewname,wdir.name); /* put file name at end of dest dir */
if (rename(wnewname,woldname)) {
printf("\n%s could not be renamed to %s",woldname,wnewname);
werr = jzfndnxt(&wdir); /* on error skip this item */
}
/* since we effectively deleted this item, the next directory */
/* search must begin from the beginning, not the next item !! */
else {
printf("\n%s renamed to %s",woldname,wnewname);
werr = jzfndfst(argv[1],32,&wdir);
}
} while (! werr);
}


  3 Responses to “Category : C Source Code
Archive   : JAZLIB.ZIP
Filename : RENFILE.DMO

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/