Right-Click on A and choosing Compress with WinRar should do the trick.
Unless of course if you have other files there which you want to exclude.
Edit: I have a solution based on Total Commander if applicable for you:
- Go to the parent directory of
A
- Press on Ctrl+B to view a flat list of all the files under that directory (may take time depending on how many files you have - I tested 8sec for 9120 files)
- Select the file/files you want
- Press on Alt+F5 to select compression of the selected files, choose a name for the archive and a destination (default is the opposite pane) and click on OK.
Total Commander will know to create the directory structure automatically.
Another option if you need this on a permanent basis and the directory structure and the file name is also constant, you can simulate the directory structure on another location on your disk, and use Junction from the Sysinternals pack to create a link from the fake D folder to the real file - then you always have an empty folder structure of A->B->C->D->test.file and don't have to worry about junk in the archive.