⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 renfile.dmo

📁 汇编语言编的关于JAZCLIBasm.rar的程序,初学者用很好好,注意了
💻 DMO
字号:
#include <jzdirect.h>
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 <old path\\old name> <new path>");
    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);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -