如何删除文件夹中的所有文件?一个文件夹不包含文件夹,但包含多个文件。
如何使用 JSL 删除这些文件?
由于该文件夹被其他层占用,无法通过删除文件夹来实现。
rd1=Delete Directory(dir);rc1=Create Directory(dir);
谢谢!
脚本视窗Re: 如何删除文件夹中的所有文件?对我来说,即使它有文件,该目录也会被删除。 也许您的某些文件仍在使用中?
Names Default To Here(1);
dir_path = "$TEMP\test\";
If(!Directory Exists(dir_path),
Create Directory(dir_path);
new_file = Save Text File(dir_path || "DeleteMe.txt", "The quick brown fox");
new_file = Save Text File(dir_path || "DeleteMe2.txt", "The quick brown fox");
);
wait(1);
Show(Directory Exists(dir_path));
Show(Files In Directory(dir_path));
Show(File Exists(new_file));
Delete Directory(dir_path);
wait(1);
Show(File Exists(new_file));
Show(Directory Exists(dir_path));
Re: 如何删除文件夹中的所有文件?如果你只想删除文件,这里是修改@jthi这样做的代码
Names Default To Here( 1 );
dir_path = "$TEMP\test\";
If( !Directory Exists( dir_path ),
Create Directory( dir_path );
new_file = Save Text File(
dir_path || "DeleteMe.txt",
"The quick brown fox"
);
new_file = Save Text File(
dir_path || "DeleteMe2.txt",
"The quick brown fox"
);
);
Wait( 1 );
// Get the files in the folder
the_Files = Files In Directory( dir_path );
For Each( {file}, the_files, rc = Delete File( dir_path || file ) );
Show( Files In Directory( dir_path ) );Re: 如何删除文件夹中的所有文件?谢谢!
我不能再使用 Windows 7。
请务必使用 JMP 16。
强大的每个()
For Each( {file}, the_files, rc = Delete File( dir_path || file ) );